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
This commit is contained in:
Jeffrey Yasskin 2010-03-20 23:08:45 +00:00
parent f2de13f8d7
commit 32989deb96
40 changed files with 61 additions and 24 deletions

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
class test<code C> {
code Code = C;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep -- 4294901760
// XFAIL: vg_leak
def X {
int Y = 0xFFFF0000;

View File

@ -1,4 +1,5 @@
// RUN: tblgen < %s
// XFAIL: vg_leak
class foo<int X> { int THEVAL = X; }
def foo_imp : foo<1>;

View File

@ -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;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {dag d = (X 13)}
// XFAIL: vg_leak
def X;
class C<int N> {

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {zing = 4} | count 4
// XFAIL: vg_leak
class C1<int A, string B> {
int bar = A;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s -o -
// XFAIL: vg_leak
class bar {
list<bar> x;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
//
// Test to make sure that lists work with any data-type

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
def {
bit A = 1;
int B = A;

View File

@ -1,5 +1,5 @@
// RUN: tblgen %s | grep {int Y = 3}
// XFAIL: vg_leak
class C {
int X = 4;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
class B<list<int> v> {
list<int> vals = v;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
class B<int v> {
int val = v;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
class A;
class B : A;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
def A {
list<int> B = [10, 20, 30, 4, 1, 1231, 20];

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {zing = 4} | count 2
// XFAIL: vg_leak
class C1<int A, string B> {
int bar = A;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep WorldHelloCC | count 1
// XFAIL: vg_leak
class C<string n> {
string name = n;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {zing = 4} | count 28
// XFAIL: vg_leak
class C1<int A, string B> {
int bar = A;

View File

@ -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;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
class x {
string y = "missing terminating '\"' character";
}

View File

@ -1,4 +1,5 @@
// RUN: tblgen < %s
// XFAIL: vg_leak
// Test for template arguments that have the same name as superclass template
// arguments.

View File

@ -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

View File

@ -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;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
// Make sure there is no collision between XX and XX.
def S;

View File

@ -1,5 +1,6 @@
// This tests to make sure we can parse tree patterns.
// RUN: tblgen %s
// XFAIL: vg_leak
class TreeNode;
class RegisterClass;

View File

@ -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;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s
// XFAIL: vg_leak
class x {
field bits<32> A;
}

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {add_ps} | count 3
// XFAIL: vg_leak
class ValueType<int size, int value> {
int Size = size;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | FileCheck %s
// XFAIL: vg_leak
// CHECK: Value = 0
// CHECK: Value = 1

View File

@ -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 {

View File

@ -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];

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {}
// XFAIL: vg_leak
class List<list<string> n> {
list<string> names = n;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep {add_ps} | count 3
// XFAIL: vg_leak
class ValueType<int size, int value> {
int Size = size;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | grep fufoo
// XFAIL: vg_leak
class Y<string S> {
string T = !strconcat(S, "foo");

View File

@ -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;

View File

@ -1,4 +1,5 @@
// RUN: tblgen %s | FileCheck %s
// XFAIL: vg_leak
// CHECK: No subst
// CHECK: No foo
// CHECK: RECURSE foo

View File

@ -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())

View File

@ -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."""

View File

@ -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)

View File

@ -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)

View File

@ -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,