From 96fe4ec19114546b6b3f369c10d4ebd0aa678530 Mon Sep 17 00:00:00 2001 From: David Bradford Date: Tue, 1 Oct 2019 22:54:41 +0000 Subject: SERVER-43732: correctly detect new files for burn_in_tests --- buildscripts/patch_builds/change_data.py | 21 ++++++++++++++++++--- etc/evergreen.yml | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/buildscripts/patch_builds/change_data.py b/buildscripts/patch_builds/change_data.py index c8e1e321359..d5ddbb9d849 100644 --- a/buildscripts/patch_builds/change_data.py +++ b/buildscripts/patch_builds/change_data.py @@ -10,10 +10,26 @@ LOGGER = structlog.get_logger(__name__) def _paths_for_iter(diff, iter_type): - return {change.a_path for change in diff.iter_change_type(iter_type)} + """ + Get the set for all the files in the given diff for the specified type. + + :param diff: git diff to query. + :param iter_type: Iter type ['M', 'A', 'R', 'D']. + :return: set of changed files. + """ + a_path_changes = {change.a_path for change in diff.iter_change_type(iter_type)} + b_path_changes = {change.b_path for change in diff.iter_change_type(iter_type)} + return a_path_changes.union(b_path_changes) def _modified_files_for_diff(diff: DiffIndex, log: Any) -> Set: + """ + Get the set of files modified in the given git diff. + + :param diff: Git diff information. + :param log: Logger for logging. + :return: Set of files that were modified in diff. + """ modified_files = _paths_for_iter(diff, 'M') log.debug("modified files", files=modified_files) @@ -23,11 +39,10 @@ def _modified_files_for_diff(diff: DiffIndex, log: Any) -> Set: renamed_files = _paths_for_iter(diff, 'R') log.debug("renamed files", files=renamed_files) - # We don't care about delete files, but log them just in case. deleted_files = _paths_for_iter(diff, 'D') log.debug("deleted files", files=deleted_files) - return modified_files.union(added_files).union(renamed_files) + return modified_files.union(added_files).union(renamed_files).union(deleted_files) def find_changed_files(repo: Repo) -> Set[str]: diff --git a/etc/evergreen.yml b/etc/evergreen.yml index aa4b552a523..9cd0746d1eb 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -5098,7 +5098,7 @@ tasks: burn_in_args="$burn_in_args --repeat-tests-min=2 --repeat-tests-max=1000 --repeat-tests-secs=600" # Evergreen executable is in $HOME. - PATH=$PATH:$HOME $python buildscripts/burn_in_tests.py --project=${project} $build_variant_opts --distro=${distro_id} --generate-tasks-file=burn_in_tests_gen.json $burn_in_args + PATH=$PATH:$HOME $python buildscripts/burn_in_tests.py --project=${project} $build_variant_opts --distro=${distro_id} --generate-tasks-file=burn_in_tests_gen.json $burn_in_args --verbose - command: archive.targz_pack params: target: src/burn_in_tests_gen.tgz -- cgit v1.2.1