[llvm-commits] [llvm] r166303 - in /llvm/trunk: docs/CommandGuide/lit.rst utils/lit/lit/ExampleTests/lit.cfg utils/lit/lit/ExampleTests/vg-fail.c utils/lit/lit/LitConfig.py utils/lit/lit/TestingConfig.py

Daniel Dunbar daniel at zuster.org
Fri Oct 19 13:12:00 PDT 2012


Author: ddunbar
Date: Fri Oct 19 15:12:00 2012
New Revision: 166303

URL: http://llvm.org/viewvc/llvm-project?rev=166303&view=rev
Log:
lit: Add 'valgrind' and 'valgrind-leaks' features when valgrind is used.
 - These can be used with the XFAIL options.

Added:
    llvm/trunk/utils/lit/lit/ExampleTests/vg-fail.c
Modified:
    llvm/trunk/docs/CommandGuide/lit.rst
    llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg
    llvm/trunk/utils/lit/lit/LitConfig.py
    llvm/trunk/utils/lit/lit/TestingConfig.py

Modified: llvm/trunk/docs/CommandGuide/lit.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/lit.rst?rev=166303&r1=166302&r2=166303&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/lit.rst (original)
+++ llvm/trunk/docs/CommandGuide/lit.rst Fri Oct 19 15:12:00 2012
@@ -125,6 +125,10 @@
  *--error-exitcode* argument for valgrind is used so that valgrind failures will
  cause the program to exit with a non-zero status.
 
+ When this option is enabled, **lit** will also automatically provide a
+ "valgrind" feature that can be used to conditionally disable (or expect failure
+ in) certain tests.
+
 
 
 **--vg-arg**\ =\ *ARG*
@@ -133,6 +137,15 @@
 
 
 
+**--vg-leak**
+
+ When *--vg* is used, enable memory leak checks. When this option is enabled,
+ **lit** will also automatically provide a "valgrind-leaks" feature that can be
+ used to conditionally disable (or expect failure in) certain tests.
+
+
+
+
 **--time-tests**
 
  Track the wall time individual tests take to execute and includes the results in

Modified: llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg?rev=166303&r1=166302&r2=166303&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg (original)
+++ llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg Fri Oct 19 15:12:00 2012
@@ -23,4 +23,4 @@
 config.target_triple = 'foo'
 
 # available_features: Used by ShTest and TclTest formats for REQUIRES checks.
-config.available_features = ['some-feature-name']
+config.available_features.add('some-feature-name')

Added: llvm/trunk/utils/lit/lit/ExampleTests/vg-fail.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/vg-fail.c?rev=166303&view=auto
==============================================================================
--- llvm/trunk/utils/lit/lit/ExampleTests/vg-fail.c (added)
+++ llvm/trunk/utils/lit/lit/ExampleTests/vg-fail.c Fri Oct 19 15:12:00 2012
@@ -0,0 +1,4 @@
+// This test should XPASS, when run without valgrind.
+
+// RUN: true
+// XFAIL: valgrind

Modified: llvm/trunk/utils/lit/lit/LitConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/LitConfig.py?rev=166303&r1=166302&r2=166303&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/LitConfig.py (original)
+++ llvm/trunk/utils/lit/lit/LitConfig.py Fri Oct 19 15:12:00 2012
@@ -42,14 +42,11 @@
         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')
             else:
                 # The default is 'summary'.

Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=166303&r1=166302&r2=166303&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
+++ llvm/trunk/utils/lit/lit/TestingConfig.py Fri Oct 19 15:12:00 2012
@@ -29,6 +29,13 @@
                         'TMP' : os.environ.get('TMP',''),
                         })
 
+            # Set the default available features based on the LitConfig.
+            available_features = []
+            if litConfig.useValgrind:
+                available_features.append('valgrind')
+                if litConfig.valgrindLeakCheck:
+                    available_features.append('valgrind-leaks')
+
             config = TestingConfig(parent,
                                    name = '<unnamed>',
                                    suffixes = set(),
@@ -40,7 +47,7 @@
                                    test_exec_root = None,
                                    test_source_root = None,
                                    excludes = [],
-                                   available_features = [])
+                                   available_features = available_features)
 
         if os.path.exists(path):
             # FIXME: Improve detection and error reporting of errors in the





More information about the llvm-commits mailing list