[llvm-commits] [zorg] r131197 - /zorg/trunk/lnt/lnt/tests/nt.py

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed May 11 13:09:05 PDT 2011


Author: stoklund
Date: Wed May 11 15:09:05 2011
New Revision: 131197

URL: http://llvm.org/viewvc/llvm-project?rev=131197&view=rev
Log:
Add a lnt runtest nt --build-threads option that runs a separate build step.

This makes it possible to first build the tests with -j8 and then run them with
-j1 for stable performance numbers.

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

Modified: zorg/trunk/lnt/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=131197&r1=131196&r2=131197&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/nt.py (original)
+++ zorg/trunk/lnt/lnt/tests/nt.py Wed May 11 15:09:05 2011
@@ -139,7 +139,7 @@
             'env DYLD_LIBRARY_PATH=%s' % os.path.dirname(
                 opts.liblto_path))
 
-    if opts.threads > 1:
+    if opts.threads > 1 or opts.build_threads > 1:
         make_variables['ENABLE_PARALLEL_REPORT'] = '1'
 
     # Select the test style to use.
@@ -339,11 +339,29 @@
     test_log_path = os.path.join(basedir, 'test.log')
     test_log = open(test_log_path, 'w')
 
-    args = ['make', '-k', '-j', str(opts.threads),
-            'report', 'report.%s.csv' % opts.test_style]
-    args.extend('%s=%s' % (k,v) for k,v in make_variables.items())
+    common_args = ['make', '-k']
+    common_args.extend('%s=%s' % (k,v) for k,v in make_variables.items())
     if opts.only_test is not None:
-        args.extend(['-C',opts.only_test])
+        common_args.extend(['-C',opts.only_test])
+
+    # Run a separate 'make build' step if --build-threads was given.
+    if opts.build_threads > 0:
+      args = common_args + ['-j', str(opts.build_threads), 'build']
+      print >>test_log, '%s: running: %s' % (timestamp(),
+                                             ' '.join('"%s"' % a
+                                                      for a in args))
+      test_log.flush()
+
+      print >>sys.stderr, '%s: building -j%u...' % (timestamp(),
+                                                     opts.build_threads)
+      p = subprocess.Popen(args=args, stdin=None, stdout=test_log,
+                           stderr=subprocess.STDOUT, cwd=basedir,
+                           env=os.environ)
+      res = p.wait()
+
+    # Then 'make report'.
+    args = common_args + ['-j', str(opts.threads),
+        'report', 'report.%s.csv' % opts.test_style]
     print >>test_log, '%s: running: %s' % (timestamp(),
                                            ' '.join('"%s"' % a
                                                     for a in args))
@@ -352,7 +370,7 @@
     # FIXME: We shouldn't need to set env=os.environ here, but if we don't
     # somehow MACOSX_DEPLOYMENT_TARGET gets injected into the environment on OS
     # X (which changes the driver behavior and causes generally weirdness).
-    print >>sys.stderr, '%s: testing...' % timestamp()
+    print >>sys.stderr, '%s: testing -j%u...' % (timestamp(), opts.threads)
     p = subprocess.Popen(args=args, stdin=None, stdout=test_log,
                          stderr=subprocess.STDOUT, cwd=basedir,
                          env=os.environ)
@@ -762,6 +780,9 @@
         group.add_option("-j", "--threads", dest="threads",
                          help="Number of testing threads",
                          type=int, default=1, metavar="N")
+        group.add_option("", "--build-threads", dest="build_threads",
+                         help="Number of compilation threads",
+                         type=int, default=0, metavar="N")
 
         group.add_option("", "--remote", dest="remote",
                          help=("Execute remotely, see "





More information about the llvm-commits mailing list