Skip to content

Commit 6000111

Browse files
author
Thomas Preud'homme
committed
[LNT] Python 3 support: sort benchmark regressing
Summary: Test server/ui/change_processing.py makes an assumption about the order in which benchmark are listed when a regression occurs but these are put in a set before being iterated over for printing. Since set have no guarantee of order, the test is fragile and fails on Python 3 due to different implementation of Set. This commit sort the benchmark when printing them so that the output is consistent. It also adapts the testcase accordingly. Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls, leandron, PrzemekWirkus Reviewed By: PrzemekWirkus Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D68803
1 parent ed0c7da commit 6000111

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lnt/server/db/regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def rebuild_title(session, ts, regression):
7171
fc = ri.field_change
7272
benchmarks.add(shortname(fc.test.name))
7373
FMT = "Regression of {} benchmarks: {}"
74-
title = FMT.format(new_size, ', '.join(benchmarks))
74+
title = FMT.format(new_size, ', '.join(sorted(benchmarks)))
7575
# Crop long titles.
7676
title = (title[:120] + '...') if len(title) > 120 else title
7777
regression.title = title

tests/server/ui/change_processing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ def test_change_grouping_criteria(self):
212212
session.commit()
213213

214214
r2 = rebuild_title(session, ts_db, self.regression)
215-
expected_title = "Regression of 6 benchmarks: foo, bar"
215+
# The list of benchmark regressing is guaranteed to be sorted.
216+
expected_title = "Regression of 6 benchmarks: bar, foo"
216217
self.assertEqual(r2.title, expected_title)
217218

218219
def test_regression_evolution(self):

0 commit comments

Comments
 (0)