diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-03-20 23:08:45 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-03-20 23:08:45 +0000 |
commit | 32989deb9641cf3878686b5634311a7a125f8f02 (patch) | |
tree | f960a33dda54f5db353abc6b301be29a7cbe4dcb /utils | |
parent | f2de13f8d7bed958538bbd9dbeb9b15ea48456cc (diff) | |
download | external_llvm-32989deb9641cf3878686b5634311a7a125f8f02.zip external_llvm-32989deb9641cf3878686b5634311a7a125f8f02.tar.gz external_llvm-32989deb9641cf3878686b5634311a7a125f8f02.tar.bz2 |
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')
-rw-r--r-- | utils/lit/lit/LitConfig.py | 18 | ||||
-rw-r--r-- | utils/lit/lit/TestFormats.py | 7 | ||||
-rw-r--r-- | utils/lit/lit/TestRunner.py | 13 | ||||
-rwxr-xr-x | utils/lit/lit/lit.py | 4 |
4 files changed, 23 insertions, 19 deletions
diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py index 0e0a493..98ca2f0 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 33fd1c1..433e39a 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 2778469..29adff2 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 436f8e7..e800754 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, |