[cfe-commits] r75368 - in /cfe/trunk: test/Makefile utils/test/TestRunner.py

Nuno Lopes nunoplopes at sapo.pt
Sat Jul 11 11:34:44 PDT 2009


Author: nlopes
Date: Sat Jul 11 13:34:43 2009
New Revision: 75368

URL: http://llvm.org/viewvc/llvm-project?rev=75368&view=rev
Log:
restore proper valgrind support.
disclaim: I know nothing about Python, so apologies in advance if I break something

Modified:
    cfe/trunk/test/Makefile
    cfe/trunk/utils/test/TestRunner.py

Modified: cfe/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Makefile?rev=75368&r1=75367&r2=75368&view=diff

==============================================================================
--- cfe/trunk/test/Makefile (original)
+++ cfe/trunk/test/Makefile Sat Jul 11 13:34:43 2009
@@ -12,9 +12,15 @@
 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/

Modified: cfe/trunk/utils/test/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/test/TestRunner.py?rev=75368&r1=75367&r2=75368&view=diff

==============================================================================
--- cfe/trunk/utils/test/TestRunner.py (original)
+++ cfe/trunk/utils/test/TestRunner.py Sat Jul 11 13:34:43 2009
@@ -71,11 +71,13 @@
                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 @@
         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 @@
         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 @@
         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:





More information about the cfe-commits mailing list