diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-01 17:37:31 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-02 10:59:05 +0000 |
commit | 7f53be6230814d3ae5c10eabc74625ef0ac5162a (patch) | |
tree | 8a0b190dff45b599495037868c86f59133316737 /testsuite/driver/perf_notes.py | |
parent | 88fba8a4b3c22e953a634b81dd0b67ec66eb5e72 (diff) | |
download | haskell-wip/marge-bot-metric.tar.gz |
testsuite: Honour PERF_BASELINE_COMMIT when computing allowed metric changeswip/marge-bot-metric
We now get all the commits between the PERF_BASELINE_COMMIT and HEAD and
check any of them for metric changes.
Fixes #20882
Diffstat (limited to 'testsuite/driver/perf_notes.py')
-rw-r--r-- | testsuite/driver/perf_notes.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 1fd37bcb4e..3f67f0d57c 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -19,7 +19,7 @@ import subprocess import time import sys -from collections import namedtuple +from collections import namedtuple, defaultdict from math import ceil, trunc from testutil import passed, failBecause, testing_metrics, print_table @@ -400,6 +400,24 @@ def commit_log(commitOrRange, n=None): print("Expected " + str(n) + " hashes, but git gave " + str(actualN) + ":\n" + output) return hashes +def add_new_changes(changes, new_changes): + for key, new_change in new_changes.items(): + changes[key].extend(new_change) + +def get_allowed_changes(baseline_ref: Optional[GitRef]) -> Dict[TestName, List[AllowedPerfChange]]: + if baseline_ref: + # The last 1000 commits in reverse order (starting from HEAD). + commit_hashes = baseline_commit_log(GitRef("HEAD")) + allowed_changes = defaultdict(list) # type: Dict[TestName, List[AllowedPerfChange]] + for commit in commit_hashes: + new_changes = get_allowed_perf_changes(commit) + if commit == baseline_ref: return dict(allowed_changes) + add_new_changes(allowed_changes, new_changes) + print("PERF_BASELINE_COMMIT not found in last 1000 commits...") + return dict() + else: + return get_allowed_perf_changes() + # Cache of baseline values. This is a dict of dicts indexed on: # (useCiNamespace, commit) -> (test_env, test, metric, way) -> baseline # (bool , str ) -> (str , str , str , str) -> float |