diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2009-07-11 18:34:43 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2009-07-11 18:34:43 +0000 |
commit | a7afc452918bae2f7bc26f903e16b183ae92b1ab (patch) | |
tree | 10bce74c60897189a0235ed706d00c75cf1923f5 | |
parent | 002b91fc1a5ea20658bd0af836bea540eaa51932 (diff) |
restore proper valgrind support.
disclaim: I know nothing about Python, so apologies in advance if I break something
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75368 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Makefile | 8 | ||||
-rwxr-xr-x | utils/test/TestRunner.py | 14 |
2 files changed, 15 insertions, 7 deletions
diff --git a/test/Makefile b/test/Makefile index 635759fa10..4c65d7c015 100644 --- a/test/Makefile +++ b/test/Makefile @@ -12,9 +12,15 @@ TESTARGS = -s endif endif +ifdef VG + VGARG="--vg" +else + VGARG= +endif + all:: @ echo '--- Running clang tests for $(TARGET_TRIPLE) ---' - @ PATH=$(ToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$$PATH VG=$(VG) $(PROJ_SRC_DIR)/../utils/test/MultiTestRunner.py $(TESTARGS) $(TESTDIRS) + @ PATH=$(ToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$$PATH $(PROJ_SRC_DIR)/../utils/test/MultiTestRunner.py $(TESTARGS) $(TESTDIRS) $(VGARG) clean:: @ rm -rf Output/ diff --git a/utils/test/TestRunner.py b/utils/test/TestRunner.py index 77158fd971..728d406e62 100755 --- a/utils/test/TestRunner.py +++ b/utils/test/TestRunner.py @@ -71,11 +71,13 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, useDGCompat=False, useScript=None, output=sys.stdout): + OUTPUT = os.path.abspath(OUTPUT) if useValgrind: VG_OUTPUT = '%s.vg'%(OUTPUT,) - if os.path.exists: - remove(VG_OUTPUT) - CLANG = 'valgrind --leak-check=full --quiet --log-file=%s %s'%(VG_OUTPUT, CLANG) + os.system('rm -f %s.*'%(VG_OUTPUT)) + VALGRIND = 'valgrind -q --tool=memcheck --leak-check=full --trace-children=yes --log-file=%s.%%p'%(VG_OUTPUT) + CLANG = '%s %s'%(VALGRIND, CLANG) + CLANGCC = '%s %s'%(VALGRIND, CLANGCC) # Create the output directory if it does not already exist. mkdir_p(os.path.dirname(OUTPUT)) @@ -105,7 +107,6 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, output.flush() return TestStatus.NoRunLine - OUTPUT = os.path.abspath(OUTPUT) FILENAME = os.path.abspath(FILENAME) SCRIPT = OUTPUT + '.script' TEMPOUTPUT = OUTPUT + '.tmp' @@ -168,7 +169,8 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, SCRIPT_STATUS = not SCRIPT_STATUS if useValgrind: - VG_STATUS = len(list(open(VG_OUTPUT))) + VG_OUTPUT = capture(['/bin/sh','-c','cat %s.*'%(VG_OUTPUT)]) + VG_STATUS = len(VG_OUTPUT) else: VG_STATUS = 0 @@ -183,7 +185,7 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, cat(OUTPUT, output) if VG_STATUS: print >>output, "Valgrind Output:" - cat(VG_OUTPUT, output) + print >>output, VG_OUTPUT print >>output, "******************** TEST '%s' FAILED! ********************"%(TESTNAME,) output.flush() if xfailLines: |