[LNT] r198496 - Revert all commits starting from 198453

Tobias Grosser tobias at grosser.es
Sat Jan 4 07:09:59 PST 2014


Author: grosser
Date: Sat Jan  4 09:09:59 2014
New Revision: 198496

URL: http://llvm.org/viewvc/llvm-project?rev=198496&view=rev
Log:
Revert all commits starting from 198453

This commit broke the following LNT buildbots:

clang-x86_64-darwin12-nt-O3
clang-native-arm-lnt
polly-perf-O3
polly-perf-O3-polly-detect

I tried to fix it myself, but there are subsequent failures popping up
that I can not address easily. Also, I have the feeling some of the
builbot flags may need to be changed, something we can not do before
Galina is back to work.

Revert "Remove another use of a parameter"

Revert "Remove a unused parameter."

Revert "Don't pass run.id back with commit=False"

Revert "Remove unused import."

Revert "Remove dead code."

Revert "Fixup comment."

Revert "Make the verbose argument not consume other tokens from the input args."

Revert "Handle the case of a missing configure file in the test suite better."

Revert "print RunID of submitted runs"

Revert "In an effort refactor the code to make way for run resampling, move the run submission code into the test suites."

Modified:
    lnt/trunk/lnt/lnttool/main.py
    lnt/trunk/lnt/tests/builtintest.py
    lnt/trunk/lnt/tests/compile.py
    lnt/trunk/lnt/tests/nt.py
    lnt/trunk/lnt/util/ImportData.py
    lnt/trunk/lnt/util/ServerUtil.py

Modified: lnt/trunk/lnt/lnttool/main.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/main.py?rev=198496&r1=198495&r2=198496&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/main.py (original)
+++ lnt/trunk/lnt/lnttool/main.py Sat Jan  4 09:09:59 2014
@@ -122,29 +122,28 @@ def action_checkformat(name, args):
 def action_runtest(name, args):
     """run a builtin test application"""
 
-    # Runtest accepting options is deprecated, but lets not break the
-    # world, so collect them anyways and pass them on.
     parser = OptionParser("%s test-name [options]" % name)
     parser.disable_interspersed_args()
-    parser.add_option("", "--submit", dest="submit", type=str, default=None)
-    parser.add_option("", "--commit", dest="commit", type=str, default=None)
-    parser.add_option("", "--output", dest="output", type=str, default=None)
-    parser.add_option("-v", "--verbose", dest="verbose", action="store_true")
+    parser.add_option("", "--submit", dest="submit_url", metavar="URLORPATH",
+                      help=("autosubmit the test result to the given server "
+                            "(or local instance) [%default]"),
+                      type=str, default=None)
+    parser.add_option("", "--commit", dest="commit",
+                      help=("whether the autosubmit result should be committed "
+                            "[%default]"),
+                      type=int, default=True)
+    parser.add_option("", "--output", dest="output", metavar="PATH",
+                      help="write raw report data to PATH (or stdout if '-')",
+                      action="store", default=None)
+    parser.add_option("-v", "--verbose", dest="verbose",
+                      help="show verbose test results",
+                      action="store_true", default=False)
 
-    (deprecated_opts, args) = parser.parse_args(args)
+    (opts, args) = parser.parse_args(args)
     if len(args) < 1:
         parser.error("incorrect number of argments")
 
-    test_name, args = args[0], args[1:]
-    # Rebuild the deprecated arguments.
-    for key, val in vars(deprecated_opts).iteritems():
-        if val is not None:
-            if isinstance(val, str):
-                args.insert(0, val)
-            args.insert(0, "--" + key)
-
-            warning("--{} should be passed directly to the"
-                        " test suite.".format(key))
+    test_name,args = args[0],args[1:]
 
     import lnt.tests
     try:
@@ -152,7 +151,50 @@ def action_runtest(name, args):
     except KeyError:
         parser.error('invalid test name %r' % test_name)
 
-    test_instance.run_test('%s %s' % (name, test_name), args)
+    report = test_instance.run_test('%s %s' % (name, test_name), args)
+
+    if opts.output is not None:
+        if opts.output == '-':
+            output_stream = sys.stdout
+        else:
+            output_stream = open(opts.output, 'w')
+        print >>output_stream, report.render()
+        if output_stream is not sys.stdout:
+            output_stream.close()
+
+    # Save the report to a temporary file.
+    #
+    # FIXME: This is silly, the underlying test probably wrote the report to a
+    # file itself. We need to clean this up and make it standard across all
+    # tests. That also has the nice side effect that writing into a local
+    # database records the correct imported_from path.
+    tmp = tempfile.NamedTemporaryFile(suffix='.json')
+    print >>tmp, report.render()
+    tmp.flush()
+
+    if opts.submit_url is not None:
+        if report is None:
+            raise SystemExit,"error: report generation failed"
+
+        from lnt.util import ServerUtil
+        test_instance.log("submitting result to %r" % (opts.submit_url,))
+        ServerUtil.submitFile(opts.submit_url, tmp.name, True, opts.verbose)
+    else:
+        # Simulate a submission to retrieve the results report.
+
+        # Construct a temporary database and import the result.
+        test_instance.log("submitting result to dummy instance")
+        
+        import lnt.server.db.v4db
+        import lnt.server.config
+        db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
+                                     lnt.server.config.Config.dummyInstance())
+        result = lnt.util.ImportData.import_and_report(
+            None, None, db, tmp.name, 'json', commit = True)
+        lnt.util.ImportData.print_report_result(result, sys.stdout, sys.stderr,
+                                                opts.verbose)
+
+    tmp.close()
 
 def action_showtests(name, args):
     """show the available built-in tests"""
@@ -188,7 +230,7 @@ def action_submit(name, args):
         parser.error("incorrect number of argments")
 
     from lnt.util import ServerUtil
-    ServerUtil.submitFiles(args[0], args[1:], opts.commit)
+    ServerUtil.submitFiles(args[0], args[1:], opts.commit, opts.verbose)
 
 def action_update(name, args):
     """create and or auto-update the given database"""

Modified: lnt/trunk/lnt/tests/builtintest.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/builtintest.py?rev=198496&r1=198495&r2=198496&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/builtintest.py (original)
+++ lnt/trunk/lnt/tests/builtintest.py Sat Jan  4 09:09:59 2014
@@ -3,17 +3,9 @@ Base class for builtin-in tests.
 """
 
 import sys
-import os
 
 from lnt.testing.util.misc import timestamp
 
-import lnt.util.ServerUtil as ServerUtil 
-import lnt.util.ImportData as ImportData
-
-import lnt.server.db.v4db
-import lnt.server.config
-
-
 class BuiltinTest(object):
     def __init__(self):
         pass
@@ -34,47 +26,3 @@ class BuiltinTest(object):
 
     def log(self, message, ts=timestamp()):
         print >>sys.stderr, '%s: %s' % (ts, message)
-
-    @staticmethod
-    def print_report(report, output):
-        """Print the report object to the output path."""
-        if output == '-':
-            output_stream = sys.stdout
-        else:
-            output_stream = open(output, 'w')
-        print >> output_stream, report.render()
-        if output_stream is not sys.stdout:
-            output_stream.close()
-
-    def submit(self, report_path, config, commit=True):
-        """Submit the results file to the server.  If no server
-        was specified, use a local mock server.
-        
-        report_path is the location of the json report file.  config
-        holds options for submission url, and verbosity.  When commit
-        is true, results will be saved in the server, otherwise you
-        will just get back a report but server state is not altered.
-
-        """
-        assert os.path.exists(report_path), "Failed report should have never gotten here!"
-        result = None
-        if config.submit_url is not None:
-            self.log("submitting result to %r" % (config.submit_url,))
-            commit = True
-            result = ServerUtil.submitFile(config.submit_url, report_path,
-                                           commit)
-        else:
-            # Simulate a submission to retrieve the results report.
-
-            # Construct a temporary database and import the result.
-            self.log("submitting result to dummy instance")
-
-            db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
-                                         lnt.server.config.Config.dummyInstance())
-            result = ImportData.import_and_report(
-                None, None, db, report_path, 'json', commit = True)
-        assert result is not None, "Results were not submitted."
-        ImportData.print_report_result(result, sys.stdout, sys.stderr,
-                                                    config.verbose)
-
-

Modified: lnt/trunk/lnt/tests/compile.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/compile.py?rev=198496&r1=198495&r2=198496&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/compile.py (original)
+++ lnt/trunk/lnt/tests/compile.py Sat Jan  4 09:09:59 2014
@@ -659,6 +659,9 @@ class CompileTest(builtintest.BuiltinTes
         parser = OptionParser(
             ("%(name)s [options] [<output file>]\n" +
              usage_info) % locals())
+        parser.add_option("-v", "--verbose", dest="verbose",
+                          help="Show more test output",
+                          action="store_true", default=False)
         parser.add_option("-s", "--sandbox", dest="sandbox_path",
                           help="Parent directory to build and run tests in",
                           type=str, default=None, metavar="PATH")
@@ -740,21 +743,6 @@ class CompileTest(builtintest.BuiltinTes
         group.add_option("", "--machine-name", dest="machine_name", type='str',
                          help="Machine name to use in submission [%default]",
                          action="store", default=platform.uname()[1])
-        group.add_option("", "--submit", dest="submit_url", metavar="URLORPATH",
-                          help=("autosubmit the test result to the given server "
-                                "(or local instance) [%default]"),
-                          type=str, default=None)
-        group.add_option("", "--commit", dest="commit",
-                          help=("whether the autosubmit result should be committed "
-                                "[%default]"),
-                          type=int, default=True)
-        group.add_option("", "--output", dest="output", metavar="PATH",
-                          help="write raw report data to PATH (or stdout if '-')",
-                          action="store", default=None)
-        group.add_option("-v", "--verbose", dest="verbose",
-                          help="show verbose test results",
-                          action="store_true", default=False)
-
         parser.add_option_group(group)
 
         opts,args = parser.parse_args(args)
@@ -1008,7 +996,7 @@ class CompileTest(builtintest.BuiltinTes
             run_info['had_errors'] = 1
 
         end_time = datetime.utcnow()
-
+        
         g_log.info('run complete')
         
         # Package up the report.
@@ -1018,15 +1006,9 @@ class CompileTest(builtintest.BuiltinTes
         # Write out the report.
         lnt_report_path = os.path.join(g_output_dir, 'report.json')
         report = lnt.testing.Report(machine, run, testsamples)
-
-        # Save report to disk for submission.
-        self.print_report(report, lnt_report_path)
-
-        # Then, also print to screen if requested.
-        if opts.output is not None:
-            self.print_report(report, opts.output)
-
-        self.submit(lnt_report_path, opts)
+        lnt_report_file = open(lnt_report_path, 'w')
+        print >>lnt_report_file, report.render()
+        lnt_report_file.close()
 
         return report
 

Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=198496&r1=198495&r2=198496&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Sat Jan  4 09:09:59 2014
@@ -815,14 +815,8 @@ def configure_test_suite(config, iterati
     configure_log.flush()
 
     print >>sys.stderr, '%s: configuring...' % timestamp()
-    try:
-        res = execute_command(configure_log, basedir, args,
-                              config.report_dir, config.verbose)
-    except OSError as e:
-        fatal('Configure failed to execute, '
-              'log is here: %r\nError: %r' % configure_log_path, e)
-    finally:
-        configure_log.close()
+    res = execute_command(configure_log, basedir, args, config.report_dir, config.verbose)
+    configure_log.close()
     if res != 0:
         fatal('Configure failed, log is here: %r' % configure_log_path)
 
@@ -1278,20 +1272,10 @@ class NTTest(builtintest.BuiltinTest):
                          metavar="NAME=VAL",
                          help="Add 'NAME' = 'VAL' to the run parameters",
                          type=str, action="append", default=[])
-        group.add_option("", "--submit", dest="submit_url", metavar="URLORPATH",
-                         help=("autosubmit the test result to the given server"
-                               " (or local instance) [%default]"),
-                         type=str, default=None)
-        group.add_option("", "--commit", dest="commit",
-                          help=("whether the autosubmit result should be committed "
-                                "[%default]"),
-                          type=int, default=True)
-        group.add_option("", "--output", dest="output", metavar="PATH",
-                          help="write raw report data to PATH (or stdout if '-')",
-                          action="store", default=None)
-        group.add_option("-v", "--verbose", dest="verbose",
-                          help="show verbose test results",
-                          action="store_true", default=False)
+        group.add_option("", "--verbose", dest="verbose",
+                         help=("Be verbose in output. Print the output of"
+                               "sub-commands."),
+                         action="store_true", default=False)
 
         parser.add_option_group(group)
 
@@ -1449,9 +1433,10 @@ class NTTest(builtintest.BuiltinTest):
                 warning('expected --isysroot when executing with '
                         '--ios-simulator-sdk')
 
-        config = TestConfiguration(vars(opts), timestamp())
         # FIXME: We need to validate that there is no configured output in the
         # test-suite directory, that borks things. <rdar://problem/7876418>
+        options = dict(vars(opts).items())
+        config = TestConfiguration(options, timestamp())
         prepare_report_dir(config)
 
         # Multisample, if requested.
@@ -1477,20 +1462,15 @@ class NTTest(builtintest.BuiltinTest):
                                 for r in reports], [])
 
             # Write out the merged report.
-            lnt_report_path = config.report_path(None)
+            lnt_report_path = os.path.join(config.report_dir, 'report.json')
             report = lnt.testing.Report(machine, run, test_samples)
             lnt_report_file = open(lnt_report_path, 'w')
-            print >>lnt_report_file, report.render()
+            print >>lnt_report_file,report.render()
             lnt_report_file.close()
 
-        else:
-            report = run_test(nick, None, config)
-
-        if config.output is not None:
-            self.print_report(report, config.output)
-
-        self.submit(config.report_path(None), config)
+            return report
 
+        report = run_test(nick, None, config)
         return report
 
 def create_instance():

Modified: lnt/trunk/lnt/util/ImportData.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ImportData.py?rev=198496&r1=198495&r2=198496&view=diff
==============================================================================
--- lnt/trunk/lnt/util/ImportData.py (original)
+++ lnt/trunk/lnt/util/ImportData.py Sat Jan  4 09:09:59 2014
@@ -1,5 +1,4 @@
-import os
-import time
+import os, re, time
 
 import lnt.testing
 import lnt.formats
@@ -87,11 +86,8 @@ def import_and_report(config, db_name, d
     if not success:
         # Record the original run this is a duplicate of.
         result['original_run'] = run.id
-    else:
-        if commit:
-            # Record the new run.id.
-            result['runid'] = run.id
 
+    reportStartTime = time.time()
     result['report_to_address'] = toAddress
     if config:
         report_url = "%s/db_%s/" % (config.zorgURL, db_name)
@@ -168,9 +164,6 @@ def print_report_result(result, out, err
         print >>out, "NOTE: This run was not committed!"
         print >>out
 
-    if 'runid' in result:
-        print >>out, "Submitted results as Run %s" % result['runid']
-
     if result['report_to_address']:
         print >>out, "Report emailed to: %r" % result['report_to_address']
         print >>out

Modified: lnt/trunk/lnt/util/ServerUtil.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ServerUtil.py?rev=198496&r1=198495&r2=198496&view=diff
==============================================================================
--- lnt/trunk/lnt/util/ServerUtil.py (original)
+++ lnt/trunk/lnt/util/ServerUtil.py Sat Jan  4 09:09:59 2014
@@ -51,7 +51,7 @@ def submitFileToInstance(path, file, com
     return lnt.util.ImportData.import_and_report(
         config, db_name, db, file, format='<auto>', commit=commit)
 
-def submitFile(url, file, commit):
+def submitFile(url, file, commit, verbose):
     # If this is a real url, submit it using urllib.
     if '://' in url:
         result = submitFileToServer(url, file, commit)
@@ -59,10 +59,10 @@ def submitFile(url, file, commit):
             return
     else:
         result = submitFileToInstance(url, file, commit)
-    return result
 
-def submitFiles(url, files, commit):
-    results = []
+    # Print the test report.
+    ImportData.print_report_result(result, sys.stdout, sys.stderr, verbose)
+
+def submitFiles(url, files, commit, verbose):
     for file in files:
-        result = submitFile(url, file, commit, verbose)
-        results.append(result)
+        submitFile(url, file, commit, verbose)





More information about the llvm-commits mailing list