lit: Pull a few more variables into the TestingConfig object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77772 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/test/MultiTestRunner.py b/utils/test/MultiTestRunner.py
index 93532eb..00cdfd4 100755
--- a/utils/test/MultiTestRunner.py
+++ b/utils/test/MultiTestRunner.py
@@ -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()
diff --git a/utils/test/TestRunner.py b/utils/test/TestRunner.py
index fb3d172..9206427 100755
--- a/utils/test/TestRunner.py
+++ b/utils/test/TestRunner.py
@@ -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]
diff --git a/utils/test/TestingConfig.py b/utils/test/TestingConfig.py
index 6b33589..998642b 100644
--- a/utils/test/TestingConfig.py
+++ b/utils/test/TestingConfig.py
@@ -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