aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/CommandGuide/lit.rst13
-rw-r--r--utils/lit/lit/ExampleTests/lit.cfg2
-rw-r--r--utils/lit/lit/ExampleTests/vg-fail.c4
-rw-r--r--utils/lit/lit/LitConfig.py3
-rw-r--r--utils/lit/lit/TestingConfig.py9
5 files changed, 26 insertions, 5 deletions
diff --git a/docs/CommandGuide/lit.rst b/docs/CommandGuide/lit.rst
index 3eb0be91f1..841bd20d17 100644
--- a/docs/CommandGuide/lit.rst
+++ b/docs/CommandGuide/lit.rst
@@ -125,6 +125,10 @@ EXECUTION OPTIONS
*--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 @@ EXECUTION OPTIONS
+**--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
diff --git a/utils/lit/lit/ExampleTests/lit.cfg b/utils/lit/lit/ExampleTests/lit.cfg
index 20ee37dcef..2629918d9f 100644
--- a/utils/lit/lit/ExampleTests/lit.cfg
+++ b/utils/lit/lit/ExampleTests/lit.cfg
@@ -23,4 +23,4 @@ config.test_exec_root = None
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')
diff --git a/utils/lit/lit/ExampleTests/vg-fail.c b/utils/lit/lit/ExampleTests/vg-fail.c
new file mode 100644
index 0000000000..e3339ff91a
--- /dev/null
+++ b/utils/lit/lit/ExampleTests/vg-fail.c
@@ -0,0 +1,4 @@
+// This test should XPASS, when run without valgrind.
+
+// RUN: true
+// XFAIL: valgrind
diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py
index c71c0ccdea..0a359a3db8 100644
--- a/utils/lit/lit/LitConfig.py
+++ b/utils/lit/lit/LitConfig.py
@@ -42,14 +42,11 @@ class LitConfig:
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'.
diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py
index 1465fec6f6..192e140538 100644
--- a/utils/lit/lit/TestingConfig.py
+++ b/utils/lit/lit/TestingConfig.py
@@ -29,6 +29,13 @@ class TestingConfig:
'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 @@ class TestingConfig:
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