Make lit pay attention to --vg for tcl tests too, which makes it work on LLVM's
authorJeffrey Yasskin <jyasskin@google.com>
Wed, 17 Mar 2010 17:04:56 +0000 (17:04 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Wed, 17 Mar 2010 17:04:56 +0000 (17:04 +0000)
non-unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98741 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestRunner.py

index 20fbc6c13a9f24f4b0754abbbcd1991089346064..d5bd01f89c66ca65a49baa559248902414660b21 100644 (file)
@@ -252,6 +252,18 @@ def executeTclScriptInternal(test, litConfig, tmpBase, commands, cwd):
         except:
             return (Test.FAIL, "Tcl 'exec' parse error on: %r" % ln)
 
+    if litConfig.useValgrind:
+        valgrindArgs = ['valgrind', '-q',
+                        '--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 = cmds[0]
     for c in cmds[1:]:
         cmd = ShUtil.Seq(cmd, '&&', c)