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 | |
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
40 files changed, 61 insertions, 24 deletions
diff --git a/test/TableGen/2003-08-03-PassCode.td b/test/TableGen/2003-08-03-PassCode.td index 7142186..c02f499 100644 --- a/test/TableGen/2003-08-03-PassCode.td +++ b/test/TableGen/2003-08-03-PassCode.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak class test<code C> { code Code = C; diff --git a/test/TableGen/2006-09-18-LargeInt.td b/test/TableGen/2006-09-18-LargeInt.td index afd813f..194699a 100644 --- a/test/TableGen/2006-09-18-LargeInt.td +++ b/test/TableGen/2006-09-18-LargeInt.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep -- 4294901760 +// XFAIL: vg_leak def X { int Y = 0xFFFF0000; diff --git a/test/TableGen/AnonDefinitionOnDemand.td b/test/TableGen/AnonDefinitionOnDemand.td index d567fc8..b10ad58 100644 --- a/test/TableGen/AnonDefinitionOnDemand.td +++ b/test/TableGen/AnonDefinitionOnDemand.td @@ -1,4 +1,5 @@ // RUN: tblgen < %s +// XFAIL: vg_leak class foo<int X> { int THEVAL = X; } def foo_imp : foo<1>; diff --git a/test/TableGen/DagDefSubst.td b/test/TableGen/DagDefSubst.td index e5eebe9..92a207f 100644 --- a/test/TableGen/DagDefSubst.td +++ b/test/TableGen/DagDefSubst.td @@ -1,5 +1,6 @@ // RUN: tblgen %s | grep {dag d = (X Y)} // RUN: tblgen %s | grep {dag e = (Y X)} +// XFAIL: vg_leak def X; class yclass; diff --git a/test/TableGen/DagIntSubst.td b/test/TableGen/DagIntSubst.td index 3c1291c..00fde69 100644 --- a/test/TableGen/DagIntSubst.td +++ b/test/TableGen/DagIntSubst.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {dag d = (X 13)} +// XFAIL: vg_leak def X; class C<int N> { diff --git a/test/TableGen/DefmInherit.td b/test/TableGen/DefmInherit.td index 4f37edf..9e16670 100644 --- a/test/TableGen/DefmInherit.td +++ b/test/TableGen/DefmInherit.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {zing = 4} | count 4 +// XFAIL: vg_leak class C1<int A, string B> { int bar = A; diff --git a/test/TableGen/ForwardRef.td b/test/TableGen/ForwardRef.td index 2056b1f..955cc14 100644 --- a/test/TableGen/ForwardRef.td +++ b/test/TableGen/ForwardRef.td @@ -1,4 +1,5 @@ // RUN: tblgen %s -o - +// XFAIL: vg_leak class bar { list<bar> x; diff --git a/test/TableGen/GeneralList.td b/test/TableGen/GeneralList.td index 7f099f2..ca92a21 100644 --- a/test/TableGen/GeneralList.td +++ b/test/TableGen/GeneralList.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak // // Test to make sure that lists work with any data-type diff --git a/test/TableGen/IntBitInit.td b/test/TableGen/IntBitInit.td index b949bfe..16ac9c8 100644 --- a/test/TableGen/IntBitInit.td +++ b/test/TableGen/IntBitInit.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak def { bit A = 1; int B = A; diff --git a/test/TableGen/LazyChange.td b/test/TableGen/LazyChange.td index 145fd0b..fa53562 100644 --- a/test/TableGen/LazyChange.td +++ b/test/TableGen/LazyChange.td @@ -1,5 +1,5 @@ // RUN: tblgen %s | grep {int Y = 3} - +// XFAIL: vg_leak class C { int X = 4; diff --git a/test/TableGen/ListArgs.td b/test/TableGen/ListArgs.td index daa0de6..a513db6 100644 --- a/test/TableGen/ListArgs.td +++ b/test/TableGen/ListArgs.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak class B<list<int> v> { list<int> vals = v; diff --git a/test/TableGen/ListArgsSimple.td b/test/TableGen/ListArgsSimple.td index b3b2078..f7caed6 100644 --- a/test/TableGen/ListArgsSimple.td +++ b/test/TableGen/ListArgsSimple.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak class B<int v> { int val = v; diff --git a/test/TableGen/ListConversion.td b/test/TableGen/ListConversion.td index 773ed6e..222b614 100644 --- a/test/TableGen/ListConversion.td +++ b/test/TableGen/ListConversion.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak class A; class B : A; diff --git a/test/TableGen/ListSlices.td b/test/TableGen/ListSlices.td index be794cf..5848a4e 100644 --- a/test/TableGen/ListSlices.td +++ b/test/TableGen/ListSlices.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak def A { list<int> B = [10, 20, 30, 4, 1, 1231, 20]; diff --git a/test/TableGen/MultiClass.td b/test/TableGen/MultiClass.td index 52ba59c..9f92b73 100644 --- a/test/TableGen/MultiClass.td +++ b/test/TableGen/MultiClass.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {zing = 4} | count 2 +// XFAIL: vg_leak class C1<int A, string B> { int bar = A; diff --git a/test/TableGen/MultiClassDefName.td b/test/TableGen/MultiClassDefName.td index 2e71f7d..138c93d 100644 --- a/test/TableGen/MultiClassDefName.td +++ b/test/TableGen/MultiClassDefName.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep WorldHelloCC | count 1 +// XFAIL: vg_leak class C<string n> { string name = n; diff --git a/test/TableGen/MultiClassInherit.td b/test/TableGen/MultiClassInherit.td index d4c4ce5..9da80ba 100644 --- a/test/TableGen/MultiClassInherit.td +++ b/test/TableGen/MultiClassInherit.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {zing = 4} | count 28 +// XFAIL: vg_leak class C1<int A, string B> { int bar = A; diff --git a/test/TableGen/Slice.td b/test/TableGen/Slice.td index cd9c6da..22bf7fb 100644 --- a/test/TableGen/Slice.td +++ b/test/TableGen/Slice.td @@ -1,5 +1,6 @@ // RUN: tblgen %s | grep {\\\[(set} | count 2 // RUN: tblgen %s | grep {\\\[\\\]} | count 2 +// XFAIL: vg_leak class ValueType<int size, int value> { int Size = size; diff --git a/test/TableGen/String.td b/test/TableGen/String.td index d2ae451..fc0f5b8 100644 --- a/test/TableGen/String.td +++ b/test/TableGen/String.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak class x { string y = "missing terminating '\"' character"; } diff --git a/test/TableGen/SuperSubclassSameName.td b/test/TableGen/SuperSubclassSameName.td index 087df87..304c883 100644 --- a/test/TableGen/SuperSubclassSameName.td +++ b/test/TableGen/SuperSubclassSameName.td @@ -1,4 +1,5 @@ // RUN: tblgen < %s +// XFAIL: vg_leak // Test for template arguments that have the same name as superclass template // arguments. diff --git a/test/TableGen/TargetInstrInfo.td b/test/TableGen/TargetInstrInfo.td index 8299541..2871eb8 100644 --- a/test/TableGen/TargetInstrInfo.td +++ b/test/TableGen/TargetInstrInfo.td @@ -1,6 +1,7 @@ // This test describes how we eventually want to describe instructions in // the target independent code generators. // RUN: tblgen %s +// XFAIL: vg_leak // Target indep stuff. class Instruction { // Would have other stuff eventually diff --git a/test/TableGen/TargetInstrSpec.td b/test/TableGen/TargetInstrSpec.td index 7c3dd57..a7ca902 100644 --- a/test/TableGen/TargetInstrSpec.td +++ b/test/TableGen/TargetInstrSpec.td @@ -1,5 +1,6 @@ // RUN: tblgen %s | grep {\\\[(set VR128:\$dst, (int_x86_sse2_add_pd VR128:\$src1, VR128:\$src2))\\\]} | count 1 // RUN: tblgen %s | grep {\\\[(set VR128:\$dst, (int_x86_sse2_add_ps VR128:\$src1, VR128:\$src2))\\\]} | count 1 +// XFAIL: vg_leak class ValueType<int size, int value> { int Size = size; diff --git a/test/TableGen/TemplateArgRename.td b/test/TableGen/TemplateArgRename.td index 535c2e4..ee5d2cf 100644 --- a/test/TableGen/TemplateArgRename.td +++ b/test/TableGen/TemplateArgRename.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak // Make sure there is no collision between XX and XX. def S; diff --git a/test/TableGen/Tree.td b/test/TableGen/Tree.td index f9f1f15..2796cfd 100644 --- a/test/TableGen/Tree.td +++ b/test/TableGen/Tree.td @@ -1,5 +1,6 @@ // This tests to make sure we can parse tree patterns. // RUN: tblgen %s +// XFAIL: vg_leak class TreeNode; class RegisterClass; diff --git a/test/TableGen/TreeNames.td b/test/TableGen/TreeNames.td index 05a3298..ccdeb88 100644 --- a/test/TableGen/TreeNames.td +++ b/test/TableGen/TreeNames.td @@ -1,5 +1,6 @@ // This tests to make sure we can parse tree patterns with names. // RUN: tblgen %s +// XFAIL: vg_leak class TreeNode; class RegisterClass; diff --git a/test/TableGen/UnsetBitInit.td b/test/TableGen/UnsetBitInit.td index 91342ec..ff70108 100644 --- a/test/TableGen/UnsetBitInit.td +++ b/test/TableGen/UnsetBitInit.td @@ -1,4 +1,5 @@ // RUN: tblgen %s +// XFAIL: vg_leak class x { field bits<32> A; } diff --git a/test/TableGen/cast.td b/test/TableGen/cast.td index 4a771ae..8164e74 100644 --- a/test/TableGen/cast.td +++ b/test/TableGen/cast.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {add_ps} | count 3 +// XFAIL: vg_leak class ValueType<int size, int value> { int Size = size; diff --git a/test/TableGen/eq.td b/test/TableGen/eq.td index 8ba6d7e..518a80a 100644 --- a/test/TableGen/eq.td +++ b/test/TableGen/eq.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | FileCheck %s +// XFAIL: vg_leak // CHECK: Value = 0 // CHECK: Value = 1 diff --git a/test/TableGen/foreach.td b/test/TableGen/foreach.td index acce449..d4d81f8 100644 --- a/test/TableGen/foreach.td +++ b/test/TableGen/foreach.td @@ -1,6 +1,7 @@ // RUN: tblgen %s | grep {Jr} | count 2 // RUN: tblgen %s | grep {Sr} | count 2 // RUN: tblgen %s | grep {NAME} | count 1 +// XFAIL: vg_leak // Variables for foreach class decls { diff --git a/test/TableGen/if.td b/test/TableGen/if.td index 9b24382..0bac0ba 100644 --- a/test/TableGen/if.td +++ b/test/TableGen/if.td @@ -1,5 +1,6 @@ // RUN: tblgen %s | grep {\\\[1, 2, 3\\\]} | count 4 // RUN: tblgen %s | grep {\\\[4, 5, 6\\\]} | count 2 +// XFAIL: vg_leak class A<list<list<int>> vals> { list<int> first = vals[0]; diff --git a/test/TableGen/lisp.td b/test/TableGen/lisp.td index 3e392fd..b521e04 100644 --- a/test/TableGen/lisp.td +++ b/test/TableGen/lisp.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {} +// XFAIL: vg_leak class List<list<string> n> { list<string> names = n; diff --git a/test/TableGen/nameconcat.td b/test/TableGen/nameconcat.td index fc865f9..fd2880a 100644 --- a/test/TableGen/nameconcat.td +++ b/test/TableGen/nameconcat.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep {add_ps} | count 3 +// XFAIL: vg_leak class ValueType<int size, int value> { int Size = size; diff --git a/test/TableGen/strconcat.td b/test/TableGen/strconcat.td index fc0d805..38409a9 100644 --- a/test/TableGen/strconcat.td +++ b/test/TableGen/strconcat.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | grep fufoo +// XFAIL: vg_leak class Y<string S> { string T = !strconcat(S, "foo"); diff --git a/test/TableGen/subst.td b/test/TableGen/subst.td index ce9f45d..05d424f 100644 --- a/test/TableGen/subst.td +++ b/test/TableGen/subst.td @@ -4,6 +4,7 @@ // RUN: tblgen %s | grep {LAST} | count 1 // RUN: tblgen %s | grep {TVAR} | count 2 // RUN: tblgen %s | grep {Bogus} | count 1 +// XFAIL: vg_leak class Honorific<string t> { string honorific = t; diff --git a/test/TableGen/subst2.td b/test/TableGen/subst2.td index 3366c9d..584266e 100644 --- a/test/TableGen/subst2.td +++ b/test/TableGen/subst2.td @@ -1,4 +1,5 @@ // RUN: tblgen %s | FileCheck %s +// XFAIL: vg_leak // CHECK: No subst // CHECK: No foo // CHECK: RECURSE foo diff --git a/test/lit.cfg b/test/lit.cfg index e65b8be..fd3120a 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -128,10 +128,9 @@ excludes = [] # Provide target_triple for use in XFAIL and XTARGET. config.target_triple = site_exp['target_triplet'] -# When running under valgrind, we mangle '-vg' onto the end of the triple so we -# can check it with XFAIL and XTARGET. -if lit.useValgrind: - config.target_triple += '-vg' +# When running under valgrind, we mangle '-vg' or '-vg_leak' onto the end of the +# triple so we can check it with XFAIL and XTARGET. +config.target_triple += lit.valgrindTriple # Provide llvm_supports_target for use in local configs. targets = set(site_exp["TARGETS_TO_BUILD"].split()) 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, |