test: Make it possible to opt in to use_clang_verify per test

This modifies the use_clang_verify parameter I added in r217009 to
only apply to tests that specifically ask for it via // USE_VERIFY.
This allows us to incrementally convert tests, but start enjoying the
benefits right away.

Suggested by Eric Fiselier in code review.

llvm-svn: 217017
This commit is contained in:
Justin Bogner 2014-09-03 06:01:52 +00:00
parent ca98874943
commit 2cfd1fed21
2 changed files with 8 additions and 3 deletions

View File

@ -67,6 +67,7 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
# Extract test metadata from the test file.
requires = []
unsupported = []
use_verify = False
with open(test.getSourcePath()) as f:
for ln in f:
if 'XFAIL:' in ln:
@ -78,6 +79,8 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
elif 'UNSUPPORTED:' in ln:
items = ln[ln.index('UNSUPPORTED:') + 12:].split(',')
unsupported.extend([s.strip() for s in items])
elif 'USE_VERIFY' in ln and self.use_verify_for_fail:
use_verify = True
elif not ln.strip().startswith("//") and ln.strip():
# Stop at the first non-empty line that is not a C++
# comment.
@ -103,9 +106,9 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
', '.join(unsupported_features),))
# Evaluate the test.
return self._evaluate_test(test, lit_config)
return self._evaluate_test(test, use_verify, lit_config)
def _evaluate_test(self, test, lit_config):
def _evaluate_test(self, test, use_verify, lit_config):
name = test.path_in_suite[-1]
source_path = test.getSourcePath()
source_dir = os.path.dirname(source_path)
@ -119,7 +122,7 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
cmd = [self.cxx_under_test, '-c',
'-o', '/dev/null', source_path] + self.cpp_flags
expected_rc = 1
if self.use_verify_for_fail:
if use_verify:
cmd += ['-Xclang', '-verify']
expected_rc = 0
out, err, rc = self.execute_command(cmd)

View File

@ -15,6 +15,8 @@
// default unique_ptr ctor should require default Deleter ctor
// USE_VERIFY
#include <memory>
class Deleter