summaryrefslogtreecommitdiff
path: root/testsuite/driver/perf_notes.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/driver/perf_notes.py')
-rw-r--r--testsuite/driver/perf_notes.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index c04c2da2c4..2bc88cd27c 100644
--- a/testsuite/driver/perf_notes.py
+++ b/testsuite/driver/perf_notes.py
@@ -76,8 +76,7 @@ PerfStat = NamedTuple('PerfStat', [('test_env', TestEnv),
# A baseline recovered form stored metrics.
Baseline = NamedTuple('Baseline', [('perfStat', PerfStat),
- ('commit', GitHash),
- ('commitDepth', int)])
+ ('commit', GitHash)])
class MetricChange(Enum):
# The metric appears to have no baseline and is presumably a new test.
@@ -402,7 +401,8 @@ def baseline_metric(commit: GitHash,
name: TestName,
test_env: TestEnv,
metric: MetricName,
- way: WayName
+ way: WayName,
+ baseline_ref: Optional[GitRef]
) -> Optional[Baseline]:
# For performance reasons (in order to avoid calling commit_hash), we assert
# commit is already a commit hash.
@@ -411,6 +411,8 @@ def baseline_metric(commit: GitHash,
# Get all recent commit hashes.
commit_hashes = baseline_commit_log(commit)
+ baseline_commit = commit_hash(baseline_ref) if baseline_ref else None
+
def has_expected_change(commit: GitHash) -> bool:
return get_allowed_perf_changes(commit).get(name) is not None
@@ -418,11 +420,18 @@ def baseline_metric(commit: GitHash,
def find_baseline(namespace: NoteNamespace,
test_env: TestEnv
) -> Optional[Baseline]:
+ if baseline_commit is not None:
+ current_metric = get_commit_metric(namespace, baseline_commit, test_env, name, metric, way)
+ if current_metric is not None:
+ return Baseline(current_metric, baseline_commit)
+ else:
+ return None
+
for depth, current_commit in list(enumerate(commit_hashes))[1:]:
# Check for a metric on this commit.
current_metric = get_commit_metric(namespace, current_commit, test_env, name, metric, way)
if current_metric is not None:
- return Baseline(current_metric, current_commit, depth)
+ return Baseline(current_metric, current_commit)
# Stop if there is an expected change at this commit. In that case
# metrics on ancestor commits will not be a valid baseline.
@@ -552,7 +561,7 @@ def check_stats_change(actual: PerfStat,
result = passed()
if not change_allowed:
error = str(change) + ' from ' + baseline.perfStat.test_env + \
- ' baseline @ HEAD~' + str(baseline.commitDepth)
+ ' baseline @ %s' % baseline.commit
print(actual.metric, error + ':')
result = failBecause('stat ' + error, tag='stat')