[LNT] r195509 - By request, add a --verbose option to LNT nt, which prints out what all the sub-commands are doing while also logging their output to a file.

Chris Matthews cmatthews5 at apple.com
Fri Nov 22 14:50:52 PST 2013


Author: cmatthews
Date: Fri Nov 22 16:50:52 2013
New Revision: 195509

URL: http://llvm.org/viewvc/llvm-project?rev=195509&view=rev
Log:
By request, add a --verbose option to LNT nt, which prints out what all the sub-commands are doing while also logging their output to a file.

Modified:
    lnt/trunk/lnt/tests/nt.py

Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=195509&r1=195508&r2=195509&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Fri Nov 22 16:50:52 2013
@@ -416,7 +416,7 @@ def scan_for_test_modules(config):
         assert dirpath.startswith(base_modules_path + '/')
         yield dirpath[len(base_modules_path) + 1:]
 
-def execute_command(test_log, basedir, args, report_dir):
+def execute_command(test_log, basedir, args, report_dir, verbose=False):
   logfile = test_log
 
   if report_dir is not None:
@@ -436,7 +436,9 @@ def execute_command(test_log, basedir, a
       if len(l) > 0:
         test_log.write(l)
         global_log.write(l)
-
+        if verbose == True:
+            sys.stdout.write(l)
+        
     global_log.close()
 
   return p.wait()
@@ -599,7 +601,7 @@ def execute_nt_tests(test_log, make_vari
 
       print >>sys.stderr, '%s: building "nightly tests" with -j%u...' % (
           timestamp(), config.build_threads)
-      res = execute_command(test_log, basedir, args, report_dir)
+      res = execute_command(test_log, basedir, args, report_dir, config.verbose)
       if res != 0:
           print >> sys.std, "Failure while running make build!  See log: %s"%(test_log.name)
 
@@ -617,7 +619,7 @@ def execute_nt_tests(test_log, make_vari
     print >>sys.stderr, '%s: executing "nightly tests" with -j%u...' % (
         timestamp(), config.threads)
 
-    res = execute_command(test_log, basedir, args, report_dir)
+    res = execute_command(test_log, basedir, args, report_dir, config.verbose)
 
     if res != 0:
         print >> sys.std, "Failure while running nightly tests!  See log: %s"%(test_log.name)
@@ -783,7 +785,7 @@ def update_tools(make_variables, config,
                                                            for a in args))
     build_tools_log.flush()
     res = execute_command(build_tools_log, config.build_dir(iteration), 
-                          args, config.report_dir)
+                          args, config.report_dir, config.verbose)
     build_tools_log.close()
     if res != 0:
         fatal('Unable to build tools, aborting! See log: %s'%(build_tools_log_path))
@@ -813,7 +815,7 @@ def configure_test_suite(config, iterati
     configure_log.flush()
 
     print >>sys.stderr, '%s: configuring...' % timestamp()
-    res = execute_command(configure_log, basedir, args, config.report_dir)
+    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)
@@ -1270,6 +1272,11 @@ class NTTest(builtintest.BuiltinTest):
                          metavar="NAME=VAL",
                          help="Add 'NAME' = 'VAL' to the run parameters",
                          type=str, action="append", default=[])
+        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)
 
         (opts, args) = parser.parse_args(args)





More information about the llvm-commits mailing list