[PATCH] D109578: [LNT] Fixed incomplete feature for submit JSON to a local instance

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 09:03:42 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rLNT4f49f39d8167: [LNT] Fixed incomplete feature for submit JSON to a local instance (authored by kpdev42).

Repository:
  rLNT LNT

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109578/new/

https://reviews.llvm.org/D109578

Files:
  lnt/lnttool/main.py
  lnt/util/ServerUtil.py


Index: lnt/util/ServerUtil.py
===================================================================
--- lnt/util/ServerUtil.py
+++ lnt/util/ServerUtil.py
@@ -71,7 +71,8 @@
         return
 
 
-def submitFileToInstance(path, file, select_machine=None, merge_run=None):
+def submitFileToInstance(path, file, select_machine=None, merge_run=None,
+                         testsuite=None):
     # Otherwise, assume it is a local url and submit to the default database
     # in the instance.
     instance = lnt.server.instance.Instance.frompath(path)
@@ -82,24 +83,28 @@
             raise ValueError("no default database in instance: %r" % (path,))
         session = db.make_session()
         return lnt.util.ImportData.import_and_report(
-            config, db_name, db, session, file, format='<auto>', ts_name='nts',
-            select_machine=select_machine, merge_run=merge_run)
+            config, db_name, db, session, file, format='<auto>',
+            ts_name=testsuite or 'nts', select_machine=select_machine,
+            merge_run=merge_run)
 
 
-def submitFile(url, file, verbose, select_machine=None, merge_run=None):
+def submitFile(url, file, verbose, select_machine=None, merge_run=None,
+               testsuite=None):
     # If this is a real url, submit it using urllib.
     if '://' in url:
         result = submitFileToServer(url, file, select_machine, merge_run)
     else:
-        result = submitFileToInstance(url, file, select_machine, merge_run)
+        result = submitFileToInstance(url, file, select_machine, merge_run,
+                                      testsuite)
     return result
 
 
-def submitFiles(url, files, verbose, select_machine=None, merge_run=None):
+def submitFiles(url, files, verbose, select_machine=None, merge_run=None,
+                testsuite=None):
     results = []
     for file in files:
         result = submitFile(url, file, verbose, select_machine=select_machine,
-                            merge_run=merge_run)
+                            merge_run=merge_run, testsuite=testsuite)
         if result:
             results.append(result)
     return results
Index: lnt/lnttool/main.py
===================================================================
--- lnt/lnttool/main.py
+++ lnt/lnttool/main.py
@@ -10,6 +10,7 @@
 from .viewcomparison import action_view_comparison
 from .admin import group_admin
 from lnt.util import logger
+from lnt.server.db.rules_manager import register_hooks
 import click
 import logging
 import sys
@@ -183,14 +184,20 @@
 @submit_options
 @click.option("--verbose", "-v", is_flag=True,
               help="show verbose test results")
-def action_submit(url, files, select_machine, merge, verbose):
+ at click.option("--testsuite", "-s", default='nts', show_default=True,
+              help="testsuite to use in case the url is a file path")
+def action_submit(url, files, select_machine, merge, verbose, testsuite):
     """submit a test report to the server"""
     from lnt.util import ServerUtil
     import lnt.util.ImportData
 
+    if '://' not in url:
+        init_logger(logging.DEBUG)
+        register_hooks()
+
     results = ServerUtil.submitFiles(url, files, verbose,
                                      select_machine=select_machine,
-                                     merge_run=merge)
+                                     merge_run=merge, testsuite=testsuite)
     for submitted_file in results:
         if verbose:
             lnt.util.ImportData.print_report_result(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109578.373956.patch
Type: text/x-patch
Size: 3497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210921/4f375648/attachment.bin>


More information about the llvm-commits mailing list