diff --git a/test/libcxx/compiler.py b/test/libcxx/compiler.py index fa5fdcdd..7afbed46 100644 --- a/test/libcxx/compiler.py +++ b/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/test/libcxx/test/config.py b/test/libcxx/test/config.py index 88724e1f..09fbf66d 100644 --- a/test/libcxx/test/config.py +++ b/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/test/libcxx/test/format.py b/test/libcxx/test/format.py index 5779bc71..f78f3878 100644 --- a/test/libcxx/test/format.py +++ b/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/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp index 95350a6f..b6bcad9a 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp +++ b/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