summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-07-06 19:56:45 +0000
committerEric Fiselier <eric@efcs.ca>2015-07-06 19:56:45 +0000
commit4cd59b3f4913bf58a731a65664cd98c9783d78ff (patch)
tree768c86f8e73e2addc3f324a20ee94228b1f2ec79 /libcxx/test
parent3505fba35aa9ce96eea27a029c9583fe1f1c6f75 (diff)
downloadbcm5719-llvm-4cd59b3f4913bf58a731a65664cd98c9783d78ff.tar.gz
bcm5719-llvm-4cd59b3f4913bf58a731a65664cd98c9783d78ff.zip
Automatically detect and use clang verify in failure tests.
Automatically enable clang verify whenever the '-verify-ignore-unexpected' flag is supported. Failure tests are run using verify if they contain one or more "expected-*" diagnostics tags. Otherwise they are run normally. llvm-svn: 241492
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/libcxx/compiler.py5
-rw-r--r--libcxx/test/libcxx/test/config.py6
-rw-r--r--libcxx/test/libcxx/test/format.py18
-rw-r--r--libcxx/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp1
4 files changed, 19 insertions, 11 deletions
diff --git a/libcxx/test/libcxx/compiler.py b/libcxx/test/libcxx/compiler.py
index fa5fdcdd9c3..7afbed461e3 100644
--- a/libcxx/test/libcxx/compiler.py
+++ b/libcxx/test/libcxx/compiler.py
@@ -139,7 +139,10 @@ class CXXCompiler(object):
return lit.util.capture(cmd).strip()
def hasCompileFlag(self, flag):
- flags = [flag]
+ if isinstance(flag, list):
+ flags = list(flag)
+ else:
+ flags = [flag]
# Add -Werror to ensure that an unrecognized flag causes a non-zero
# exit code. -Werror is supported on all known compiler types.
if self.type is not None:
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py
index 88724e1f2f0..09fbf66dbba 100644
--- a/libcxx/test/libcxx/test/config.py
+++ b/libcxx/test/libcxx/test/config.py
@@ -201,8 +201,10 @@ class Configuration(object):
'''If set, run clang with -verify on failing tests.'''
self.use_clang_verify = self.get_lit_bool('use_clang_verify')
if self.use_clang_verify is None:
- # TODO: Default this to True when using clang.
- self.use_clang_verify = False
+ # NOTE: We do not test for the -verify flag directly because
+ # -verify will always exit with non-zero on an empty file.
+ self.use_clang_verify = self.cxx.hasCompileFlag(
+ ['-Xclang', '-verify-ignore-unexpected'])
self.lit_config.note(
"inferred use_clang_verify as: %r" % self.use_clang_verify)
diff --git a/libcxx/test/libcxx/test/format.py b/libcxx/test/libcxx/test/format.py
index 5779bc71eca..f78f387881f 100644
--- a/libcxx/test/libcxx/test/format.py
+++ b/libcxx/test/libcxx/test/format.py
@@ -141,13 +141,16 @@ class LibcxxTestFormat(object):
def _evaluate_fail_test(self, test):
source_path = test.getSourcePath()
- # TODO: Move the checking of USE_VERIFY into
- # lit.TestRunner.parseIntegratedTestScript by adding support for custom
- # tags.
with open(source_path, 'r') as f:
contents = f.read()
- use_verify = 'USE_VERIFY' in contents and self.use_verify_for_fail
- extra_flags = ['-Xclang', '-verify'] if use_verify else []
+ verify_tags = ['expected-note', 'expected-remark', 'expected-warning',
+ 'expected-error', 'expected-no-diagnostics']
+ use_verify = self.use_verify_for_fail and \
+ any([tag in contents for tag in verify_tags])
+ extra_flags = []
+ if use_verify:
+ extra_flags += ['-Xclang', '-verify',
+ '-Xclang', '-verify-ignore-unexpected=note']
cmd, out, err, rc = self.cxx.compile(source_path, out=os.devnull,
flags=extra_flags)
expected_rc = 0 if use_verify else 1
@@ -155,5 +158,6 @@ class LibcxxTestFormat(object):
return lit.Test.PASS, ''
else:
report = libcxx.util.makeReport(cmd, out, err, rc)
- return (lit.Test.FAIL,
- report + 'Expected compilation to fail!\n')
+ report_msg = ('Expected compilation to fail!' if use_verify else
+ 'Expected compilation using verify to pass!')
+ return lit.Test.FAIL, report + report_msg + '\n'
diff --git a/libcxx/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp b/libcxx/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
index 95350a6fc0e..b6bcad9a91c 100644
--- a/libcxx/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
+++ b/libcxx/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
@@ -15,7 +15,6 @@
// default unique_ptr ctor should require default Deleter ctor
-// USE_VERIFY
#include <memory>
OpenPOWER on IntegriCloud