summaryrefslogtreecommitdiff
path: root/utils/lit/lit
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-03-20 23:08:45 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-03-20 23:08:45 +0000
commit32989deb9641cf3878686b5634311a7a125f8f02 (patch)
treef960a33dda54f5db353abc6b301be29a7cbe4dcb /utils/lit/lit
parentf2de13f8d7bed958538bbd9dbeb9b15ea48456cc (diff)
downloadllvm-32989deb9641cf3878686b5634311a7a125f8f02.tar.gz
llvm-32989deb9641cf3878686b5634311a7a125f8f02.tar.bz2
llvm-32989deb9641cf3878686b5634311a7a125f8f02.tar.xz
Add support for XFAILing valgrind runs with memory leak checking independently
of runs without leak checking. We add -vg to the triple for non-checked runs, or -vg_leak for checked runs. Also use this to XFAIL the TableGen tests, since tablegen leaks like a sieve. This includes some valgrindArgs refactoring. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit/lit')
-rw-r--r--utils/lit/lit/LitConfig.py18
-rw-r--r--utils/lit/lit/TestFormats.py7
-rw-r--r--utils/lit/lit/TestRunner.py13
-rwxr-xr-xutils/lit/lit/lit.py4
4 files changed, 23 insertions, 19 deletions
diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py
index 0e0a4931dc..98ca2f0473 100644
--- a/utils/lit/lit/LitConfig.py
+++ b/utils/lit/lit/LitConfig.py
@@ -15,7 +15,7 @@ class LitConfig:
import Util as util
def __init__(self, progname, path, quiet,
- useValgrind, valgrindArgs,
+ useValgrind, valgrindLeakCheck, valgrindArgs,
useTclAsSh,
noExecute, debug, isWindows,
params):
@@ -25,7 +25,8 @@ class LitConfig:
self.path = list(map(str, path))
self.quiet = bool(quiet)
self.useValgrind = bool(useValgrind)
- self.valgrindArgs = list(valgrindArgs)
+ self.valgrindLeakCheck = bool(valgrindLeakCheck)
+ self.valgrindUserArgs = list(valgrindArgs)
self.useTclAsSh = bool(useTclAsSh)
self.noExecute = noExecute
self.debug = debug
@@ -36,6 +37,19 @@ class LitConfig:
self.numErrors = 0
self.numWarnings = 0
+ self.valgrindArgs = []
+ self.valgrindTriple = ""
+ if self.useValgrind:
+ self.valgrindTriple = "-vg"
+ self.valgrindArgs = ['valgrind', '-q', '--run-libc-freeres=no',
+ '--tool=memcheck', '--trace-children=yes',
+ '--error-exitcode=123']
+ if self.valgrindLeakCheck:
+ self.valgrindTriple += "_leak"
+ self.valgrindArgs.append('--leak-check=full')
+ self.valgrindArgs.extend(self.valgrindUserArgs)
+
+
def load_config(self, config, path):
"""load_config(config, path) - Load a config object from an alternate
path."""
diff --git a/utils/lit/lit/TestFormats.py b/utils/lit/lit/TestFormats.py
index 33fd1c1d12..433e39a627 100644
--- a/utils/lit/lit/TestFormats.py
+++ b/utils/lit/lit/TestFormats.py
@@ -73,12 +73,7 @@ class GoogleTest(object):
cmd = [testPath, '--gtest_filter=' + testName]
if litConfig.useValgrind:
- valgrindArgs = ['valgrind', '-q', '--run-libc-freeres=no',
- '--tool=memcheck', '--trace-children=yes',
- '--error-exitcode=123']
- valgrindArgs.extend(litConfig.valgrindArgs)
-
- cmd = valgrindArgs + cmd
+ cmd = litConfig.valgrindArgs + cmd
out, err, exitCode = TestRunner.executeCommand(
cmd, env=test.config.environment)
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index 2778469daa..29adff2229 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -253,16 +253,12 @@ def executeTclScriptInternal(test, litConfig, tmpBase, commands, cwd):
return (Test.FAIL, "Tcl 'exec' parse error on: %r" % ln)
if litConfig.useValgrind:
- valgrindArgs = ['valgrind', '-q', '--run-libc-freeres=no',
- '--tool=memcheck', '--trace-children=yes',
- '--error-exitcode=123']
- valgrindArgs.extend(litConfig.valgrindArgs)
for pipeline in cmds:
if pipeline.commands:
# Only valgrind the first command in each pipeline, to avoid
# valgrinding things like grep, not, and FileCheck.
cmd = pipeline.commands[0]
- cmd.args = valgrindArgs + cmd.args
+ cmd.args = litConfig.valgrindArgs + cmd.args
cmd = cmds[0]
for c in cmds[1:]:
@@ -339,12 +335,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
if litConfig.useValgrind:
# FIXME: Running valgrind on sh is overkill. We probably could just
# run on clang with no real loss.
- valgrindArgs = ['valgrind', '-q', '--run-libc-freeres=no',
- '--tool=memcheck', '--trace-children=yes',
- '--error-exitcode=123']
- valgrindArgs.extend(litConfig.valgrindArgs)
-
- command = valgrindArgs + command
+ command = litConfig.valgrindArgs + command
return executeCommand(command, cwd=cwd, env=test.config.environment)
diff --git a/utils/lit/lit/lit.py b/utils/lit/lit/lit.py
index 436f8e7a41..e80075478a 100755
--- a/utils/lit/lit/lit.py
+++ b/utils/lit/lit/lit.py
@@ -362,6 +362,9 @@ def main():
group.add_option("", "--vg", dest="useValgrind",
help="Run tests under valgrind",
action="store_true", default=False)
+ group.add_option("", "--vg-leak", dest="valgrindLeakCheck",
+ help="Check for memory leaks under valgrind",
+ action="store_true", default=False)
group.add_option("", "--vg-arg", dest="valgrindArgs", metavar="ARG",
help="Specify an extra argument for valgrind",
type=str, action="append", default=[])
@@ -436,6 +439,7 @@ def main():
path = opts.path,
quiet = opts.quiet,
useValgrind = opts.useValgrind,
+ valgrindLeakCheck = opts.valgrindLeakCheck,
valgrindArgs = opts.valgrindArgs,
useTclAsSh = opts.useTclAsSh,
noExecute = opts.noExecute,