[cfe-commits] r77772 - in /cfe/trunk/utils/test: MultiTestRunner.py TestRunner.py TestingConfig.py

Daniel Dunbar daniel at zuster.org
Fri Jul 31 21:06:02 PDT 2009


Author: ddunbar
Date: Fri Jul 31 23:06:02 2009
New Revision: 77772

URL: http://llvm.org/viewvc/llvm-project?rev=77772&view=rev
Log:
lit: Pull a few more variables into the TestingConfig object.

Modified:
    cfe/trunk/utils/test/MultiTestRunner.py
    cfe/trunk/utils/test/TestRunner.py
    cfe/trunk/utils/test/TestingConfig.py

Modified: cfe/trunk/utils/test/MultiTestRunner.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/test/MultiTestRunner.py?rev=77772&r1=77771&r2=77772&view=diff

==============================================================================
--- cfe/trunk/utils/test/MultiTestRunner.py (original)
+++ cfe/trunk/utils/test/MultiTestRunner.py Fri Jul 31 23:06:02 2009
@@ -167,14 +167,12 @@
             opts = self.provider.opts
             startTime = time.time()
             code, output = TestRunner.runOneTest(self.provider.config, 
-                                                 path, base, 
-                                                 opts.clang, opts.clangcc,
-                                                 opts.useValgrind)
+                                                 path, base)
             elapsed = time.time() - startTime
         except KeyboardInterrupt:
             # This is a sad hack. Unfortunately subprocess goes
             # bonkers with ctrl-c and we start forking merrily.
-            print 'Ctrl-C detected, goodbye.'
+            print '\nCtrl-C detected, goodbye.'
             os.kill(0,9)
 
         self.provider.setResult(index, TestResult(path, code, output, elapsed))
@@ -313,6 +311,10 @@
     if opts.clangcc is None:
         opts.clangcc = TestRunner.inferClangCC(cfg, opts.clang)
 
+    cfg.clang = opts.clang
+    cfg.clangcc = opts.clangcc
+    cfg.useValgrind = opts.useValgrind
+
     # FIXME: It could be worth loading these in parallel with testing.
     allTests = list(getTests(cfg, args))
     allTests.sort()

Modified: cfe/trunk/utils/test/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/test/TestRunner.py?rev=77772&r1=77771&r2=77772&view=diff

==============================================================================
--- cfe/trunk/utils/test/TestRunner.py (original)
+++ cfe/trunk/utils/test/TestRunner.py Fri Jul 31 23:06:02 2009
@@ -1,20 +1,3 @@
-#!/usr/bin/env python
-#
-#  TestRunner.py - This script is used to run arbitrary unit tests.  Unit
-#  tests must contain the command used to run them in the input file, starting
-#  immediately after a "RUN:" string.
-#
-#  This runner recognizes and replaces the following strings in the command:
-#
-#     %s - Replaced with the input name of the program, or the program to
-#          execute, as appropriate.
-#     %S - Replaced with the directory where the input resides.
-#     %llvmgcc - llvm-gcc command
-#     %llvmgxx - llvm-g++ command
-#     %prcontext - prcontext.tcl script
-#     %t - temporary file name (derived from testcase name)
-#
-
 import errno
 import os
 import platform
@@ -39,7 +22,7 @@
     def getName(code): 
         return TestStatus.kNames[code]
 
-def executeScript(cfg, script, commands, cwd, useValgrind):
+def executeScript(cfg, script, commands, cwd):
     # Write script file
     f = open(script,'w')
     if kSystemName == 'Windows':
@@ -53,9 +36,9 @@
         command = ['cmd','/c', script]
     else:
         command = ['/bin/sh', script]
-        if useValgrind:
+        if cfg.useValgrind:
             # FIXME: Running valgrind on sh is overkill. We probably could just
-            # ron on clang with no real loss.
+            # run on clang with no real loss.
             command = ['valgrind', '-q',
                        '--tool=memcheck', '--leak-check=no', '--trace-children=yes',
                        '--error-exitcode=123'] + command
@@ -75,7 +58,7 @@
     return out, err, exitCode
 
 import StringIO
-def runOneTest(cfg, testPath, tmpBase, clang, clangcc, useValgrind):
+def runOneTest(cfg, testPath, tmpBase):
     # Make paths absolute.
     tmpBase = os.path.abspath(tmpBase)
     testPath = os.path.abspath(testPath)
@@ -90,8 +73,8 @@
     substitutions = [('%s', testPath),
                      ('%S', os.path.dirname(testPath)),
                      ('%t', tmpBase + '.tmp'),
-                     (' clang ', ' ' + clang + ' '),
-                     (' clang-cc ', ' ' + clangcc + ' ')]
+                     (' clang ', ' ' + cfg.clang + ' '),
+                     (' clang-cc ', ' ' + cfg.clangcc + ' ')]
 
     # Collect the test lines from the script.
     scriptLines = []
@@ -137,8 +120,7 @@
         scriptLines[i] = ln[:-2]
 
     out, err, exitCode = executeScript(cfg, script, scriptLines, 
-                                       os.path.dirname(testPath),
-                                       useValgrind)
+                                       os.path.dirname(testPath))
     if xfailLines:
         ok = exitCode != 0
         status = (TestStatus.XPass, TestStatus.XFail)[ok]

Modified: cfe/trunk/utils/test/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/test/TestingConfig.py?rev=77772&r1=77771&r2=77772&view=diff

==============================================================================
--- cfe/trunk/utils/test/TestingConfig.py (original)
+++ cfe/trunk/utils/test/TestingConfig.py Fri Jul 31 23:06:02 2009
@@ -13,9 +13,13 @@
                              environment = data.get('environment', {}))
 
     def __init__(self, suffixes, environment):
-        self.root = None
         self.suffixes = set(suffixes)
         self.environment = dict(environment)
-        
 
+        # Variables set internally.
+        self.root = None
+        self.useValgrind = None
 
+        # FIXME: These need to move into a substitutions mechanism.
+        self.clang = None
+        self.clangcc = None





More information about the cfe-commits mailing list