[LNT] r307314 - Improve testsuite guess for db_XXX/submitRun

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 13:57:34 PDT 2017


Author: matze
Date: Thu Jul  6 13:57:34 2017
New Revision: 307314

URL: http://llvm.org/viewvc/llvm-project?rev=307314&view=rev
Log:
Improve testsuite guess for db_XXX/submitRun

Testsuites have to be specified explicitely now as they are not part of
the json format anymore. You usually do this by using a full URL like
db_XXX/v4/YYYY/submitRun to submit to test suite YYYY; Using the old URL
db_XXXX/submitRun would fallback to a hardcoded default of 'nts'.  Turns
out there is a lot more non-nts jobs out there, so improving the
guessing logic for submissions in the old format is worth it.

Modified:
    lnt/trunk/lnt/server/ui/views.py
    lnt/trunk/tests/lnttool/submit.py

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=307314&r1=307313&r2=307314&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Thu Jul  6 13:57:34 2017
@@ -139,6 +139,24 @@ def _do_submit():
     os.write(fd, data_value)
     os.close(fd)
 
+    # The following accomodates old submitters. Note that we explicitely removed
+    # the tag field from the new submission format, this is only here for old
+    # submission jobs. The better way of doing it is mentioning the correct
+    # test-suite in the URL. So when submitting to suite YYYY use
+    # db_XXX/v4/YYYY/submitRun instead of db_XXXX/submitRun!
+    if g.testsuite_name is None:
+        try:
+            data = json.loads(data_value)
+            Run = data.get('Run')
+            if Run is not None:
+                Info = Run.get('Info')
+                if Info is not None:
+                    g.testsuite_name = Info.get('tag')
+        except Exception as e:
+            pass
+    if g.testsuite_name is None:
+        g.testsuite_name = 'nts'
+
     # Get a DB connection.
     db = request.get_db()
 
@@ -162,7 +180,10 @@ def _do_submit():
 @db_route('/submitRun', only_v3=False, methods=('GET', 'POST'))
 def submit_run():
     """Compatibility url that hardcodes testsuite to 'nts'"""
-    g.testsuite_name = 'nts'
+    # This route doesn't know the testsuite to use. We have some defaults/
+    # autodetection for old submissions, but really you should use the full
+    # db_XXX/v4/YYYY/submitRun URL when using non-nts suites.
+    g.testsuite_name = None
     return _do_submit()
 
 

Modified: lnt/trunk/tests/lnttool/submit.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/lnttool/submit.py?rev=307314&r1=307313&r2=307314&view=diff
==============================================================================
--- lnt/trunk/tests/lnttool/submit.py (original)
+++ lnt/trunk/tests/lnttool/submit.py Thu Jul  6 13:57:34 2017
@@ -60,6 +60,18 @@
 # RUN:   --commit=1 %S/Inputs/compile_submission.json -v \
 # RUN:   | FileCheck %s --check-prefix=CHECK-OLDFORMAT-COMPILE
 #
+# For the old format we have some detection logic to determine the test-suite
+# based on the Info.Run.tag field instead of the URL. The result should be the
+# same as using the "correct" URL.
+#
+# RUN: rm -rf %t.instance
+# RUN: python %{shared_inputs}/create_temp_instance.py \
+# RUN:   %s %{shared_inputs}/SmallInstance %t.instance
+# RUN: %{shared_inputs}/server_wrapper.sh %t.instance 9091 \
+# RUN:   lnt submit "http://localhost:9091/db_default/submitRun" \
+# RUN:   --commit=1 %S/Inputs/compile_submission.json -v \
+# RUN:   | FileCheck %s --check-prefix=CHECK-OLDFORMAT-COMPILE
+#
 # CHECK-OLDFORMAT-COMPILE: --- Tested: 10 tests --
 #
 # CHECK-OLDFORMAT-COMPILE: Imported Data




More information about the llvm-commits mailing list