summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorDavid Bradford <david.bradford@mongodb.com>2019-08-28 19:56:13 +0000
committerevergreen <evergreen@mongodb.com>2019-08-28 19:56:13 +0000
commit490121d145eb5f22ed37c06469093e1f002f9007 (patch)
tree2a7f928ea76889d8c6afcda35ff48bd66f29732b /buildscripts
parent7393a7189f323f820b899f5521be18a7edfdfd11 (diff)
downloadmongo-490121d145eb5f22ed37c06469093e1f002f9007.tar.gz
SERVER-41990 Burn_in should not average hook times for unique hooks
(cherry picked from commit 888f3013fa3fe2dafb248e3996b4667c8075bda3) (cherry picked from commit b5a6ad7f0a9ca638c0c3c06ccf9a1620739efdb3)
Diffstat (limited to 'buildscripts')
-rwxr-xr-xbuildscripts/evergreen_generate_resmoke_tasks.py19
-rw-r--r--buildscripts/tests/test_evergreen_generate_resmoke_tasks.py2
2 files changed, 11 insertions, 10 deletions
diff --git a/buildscripts/evergreen_generate_resmoke_tasks.py b/buildscripts/evergreen_generate_resmoke_tasks.py
index 31eacaacae1..11b731f963c 100755
--- a/buildscripts/evergreen_generate_resmoke_tasks.py
+++ b/buildscripts/evergreen_generate_resmoke_tasks.py
@@ -428,8 +428,9 @@ class TestStats(object):
"""Initialize the TestStats with raw results from the Evergreen API."""
# Mapping from test_file to {"num_run": X, "duration": Y} for tests
self._runtime_by_test = defaultdict(dict)
- # Mapping from test_name to {"num_run": X, "duration": Y} for hooks
- self._hook_runtime_by_test = defaultdict(dict)
+ # Mapping from 'test_name:hook_name' to
+ # {'test_name': {hook_name': {"num_run": X, "duration": Y}}}
+ self._hook_runtime_by_test = defaultdict(lambda: defaultdict(dict))
for doc in evg_test_stats_results:
self._add_stats(doc)
@@ -447,16 +448,17 @@ class TestStats(object):
def _add_test_stats(self, test_file, duration, num_run):
"""Add the statistics for a test."""
- self._add_runtime_info(self._runtime_by_test, test_file, duration, num_run)
+ runtime_info = self._runtime_by_test[test_file]
+ self._add_runtime_info(runtime_info, duration, num_run)
def _add_test_hook_stats(self, test_file, duration, num_run):
"""Add the statistics for a hook."""
- test_name = testname.split_test_hook_name(test_file)[0]
- self._add_runtime_info(self._hook_runtime_by_test, test_name, duration, num_run)
+ test_name, hook_name = testname.split_test_hook_name(test_file)
+ runtime_info = self._hook_runtime_by_test[test_name][hook_name]
+ self._add_runtime_info(runtime_info, duration, num_run)
@staticmethod
- def _add_runtime_info(runtime_dict, test_name, duration, num_run):
- runtime_info = runtime_dict[test_name]
+ def _add_runtime_info(runtime_info, duration, num_run):
if not runtime_info:
runtime_info["duration"] = duration
runtime_info["num_run"] = num_run
@@ -476,8 +478,7 @@ class TestStats(object):
for test_file, runtime_info in self._runtime_by_test.items():
duration = runtime_info["duration"]
test_name = testname.get_short_name_from_test_file(test_file)
- hook_runtime_info = self._hook_runtime_by_test[test_name]
- if hook_runtime_info:
+ for _, hook_runtime_info in self._hook_runtime_by_test[test_name].items():
duration += hook_runtime_info["duration"]
tests.append((normalize_test_name(test_file), duration))
return sorted(tests, key=lambda x: x[1], reverse=True)
diff --git a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py
index 7dc8a651e32..09757a85ad2 100644
--- a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py
+++ b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py
@@ -53,7 +53,7 @@ class TestTestStats(unittest.TestCase):
]
test_stats = grt.TestStats(evg_results)
expected_runtimes = [
- ("dir/test3.js", 42.5),
+ ("dir/test3.js", 75),
("dir/test2.js", 30),
("dir/test1.js", 20),
]