[PATCH] D93111: LNT: Fix baseline lookup in run view.
Tamar Christina via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 11 05:56:02 PST 2020
tnfchris created this revision.
tnfchris added a reviewer: thopre.
tnfchris requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The v4_set_baseline route currently always sets the session baseline
using the default key (passing ts_name=None implicitly), however the
logic to actually look up the baseline (get_baseline_run in
testsuitedb.py) always uses the ts-specific key. This mismatch means
that generate_run_data fails to look up the correct baseline and instead
always uses the default fallback.
It appears that the implicit default parameter to baseline_key is never
relied upon in a way that isn't broken, so we simply remove the default
and pass ts.name explicitly everywhere.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93111
Files:
lnt/server/ui/util.py
lnt/server/ui/views.py
Index: lnt/server/ui/views.py
===================================================================
--- lnt/server/ui/views.py
+++ lnt/server/ui/views.py
@@ -174,7 +174,7 @@
def ts_data(ts):
"""Data about the current testsuite used by layout.html which should be
present in most templates."""
- baseline_id = flask.session.get(baseline_key())
+ baseline_id = flask.session.get(baseline_key(ts.name))
baselines = request.session.query(ts.Baseline).all()
return {
'baseline_id': baseline_id,
@@ -648,7 +648,7 @@
if not base:
return abort(404)
flash("Baseline set to " + base.name, FLASH_SUCCESS)
- flask.session[baseline_key()] = id
+ flask.session[baseline_key(ts.name)] = id
return redirect(get_redirect_target())
@@ -1666,7 +1666,7 @@
"""
session = request.session
ts = request.get_testsuite()
- base_id = flask.session.get(baseline_key())
+ base_id = flask.session.get(baseline_key(ts.name))
if not base_id:
return None
try:
Index: lnt/server/ui/util.py
===================================================================
--- lnt/server/ui/util.py
+++ lnt/server/ui/util.py
@@ -249,18 +249,9 @@
return last_path_name
-def baseline_key(ts_name=None):
- """A unique name for baseline session keys per DB and suite.
-
- Optionally, get the test-suite name from a parameter, when this is called
- during submission the global context does not know which test-suite we are
- in until too late.
- """
- if ts_name:
- name = ts_name
- else:
- name = g.db_name
- return "baseline-{}-{}".format(name, g.db_name)
+def baseline_key(ts_name):
+ """A unique name for baseline session keys per DB and suite."""
+ return "baseline-{}-{}".format(ts_name, g.db_name)
integral_rex = re.compile(r"[\d]+")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93111.311199.patch
Type: text/x-patch
Size: 1858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201211/a0450994/attachment.bin>
More information about the llvm-commits
mailing list