[LNT] r258053 - [test-suite-cmake] Add support for nicknames

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 18 09:03:36 PST 2016


Author: jamesm
Date: Mon Jan 18 11:03:36 2016
New Revision: 258053

URL: http://llvm.org/viewvc/llvm-project?rev=258053&view=rev
Log:
[test-suite-cmake] Add support for nicknames

Modified:
    lnt/trunk/lnt/tests/test_suite.py
    lnt/trunk/tests/runtest/test_suite.py

Modified: lnt/trunk/lnt/tests/test_suite.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/test_suite.py?rev=258053&r1=258052&r2=258053&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/test_suite.py (original)
+++ lnt/trunk/lnt/tests/test_suite.py Mon Jan 18 11:03:36 2016
@@ -1,4 +1,4 @@
-import subprocess, tempfile, json, os, shlex
+import subprocess, tempfile, json, os, shlex, platform
 
 from optparse import OptionParser, OptionGroup
 
@@ -123,6 +123,9 @@ class TestSuiteTest(BuiltinTest):
         parser.add_option_group(group)
 
         group = OptionGroup(parser, "Output Options")
+        group.add_option("", "--no-auto-name", dest="auto_name",
+                         help="Don't automatically derive submission name",
+                         action="store_false", default=True)
         group.add_option("", "--submit", dest="submit_url", metavar="URLORPATH",
                          help=("autosubmit the test result to the given server"
                                " (or local instance) [%default]"),
@@ -155,8 +158,12 @@ class TestSuiteTest(BuiltinTest):
 
         (opts, args) = parser.parse_args(args)
         self.opts = opts
-        
-        if args:
+
+        if len(args) == 0:
+            self.nick = platform.uname()[1]
+        elif len(args) == 1:
+            self.nick = args[0]
+        else:
             parser.error("Expected no positional arguments (got: %r)" % (args,))
 
         for a in ['cross_compiling', 'cross_compiling_system_name', 'llvm_arch',
@@ -227,13 +234,21 @@ class TestSuiteTest(BuiltinTest):
             note("Increasing number of execution samples to %d" %
                  opts.compile_multisample)
             opts.exec_multisample = opts.compile_multisample
-        
+
+        if opts.auto_name:
+            # Construct the nickname from a few key parameters.
+            cc_info = self._get_cc_info()
+            cc_nick = '%s_%s' % (cc_info['cc_name'], cc_info['cc_build'])
+            self.nick += "__%s__%s" % (cc_nick,
+                                       cc_info['cc_target'].split('-')[0])
+        note('Using nickname: %r' % self.nick)
+            
         # Now do the actual run.
         reports = []
         for i in range(max(opts.exec_multisample, opts.compile_multisample)):
             c = i < opts.compile_multisample
             e = i < opts.exec_multisample
-            reports.append(self.run("FIXME: nick", compile=c, test=e))
+            reports.append(self.run(self.nick, compile=c, test=e))
             
         report = self._create_merged_report(reports)
 
@@ -433,7 +448,7 @@ class TestSuiteTest(BuiltinTest):
         machine_info = {
         }
         
-        machine = lnt.testing.Machine("jm", machine_info)
+        machine = lnt.testing.Machine(self.nick, machine_info)
         run = lnt.testing.Run(self.start_time, timestamp(), info=run_info)
         report = lnt.testing.Report(machine, run, test_samples)
         return report

Modified: lnt/trunk/tests/runtest/test_suite.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/test_suite.py?rev=258053&r1=258052&r2=258053&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/test_suite.py (original)
+++ lnt/trunk/tests/runtest/test_suite.py Mon Jan 18 11:03:36 2016
@@ -1,5 +1,7 @@
 # Testing for the 'lnt runtest test-suite' module.
 #
+# RUN: rm -r  %t.SANDBOX  %t.SANDBOX2 || true
+#
 # Check a basic nt run.
 # RUN: lnt runtest test-suite \
 # RUN:     --sandbox %t.SANDBOX \
@@ -57,3 +59,18 @@
 # RUN:     > %t.log 2> %t.err
 # RUN: FileCheck --check-prefix CHECK-NOCONF2 < %t.err %s
 # CHECK-NOCONF2: Configuring
+
+# Change the machine name. Don't use LLVM.
+# RUN: lnt runtest test-suite \
+# RUN:     --sandbox %t.SANDBOX \
+# RUN:     --no-timestamp \
+# RUN:     --no-configure \
+# RUN:     --test-suite %S/Inputs/test-suite-cmake \
+# RUN:     --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN:     --use-cmake %S/Inputs/test-suite-cmake/fake-cmake \
+# RUN:     --use-make %S/Inputs/test-suite-cmake/fake-make \
+# RUN:     --use-lit %S/Inputs/test-suite-cmake/fake-lit \
+# RUN:     --no-auto-name foo \
+# RUN:     > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-AUTONAME < %t.err %s
+# CHECK-AUTONAME: Using nickname: 'foo'




More information about the llvm-commits mailing list