[libc++] Remove workaround for .fail.cpp tests that don't have clang-verify markup

By renaming .fail.cpp tests that don't need clang-verify to .compile.fail.cpp,
the new test format will not try to compile these tests with clang-verify,
and the old test format will work just the same. However, this allows
removing a workaround that requires parsing each test looking for
clang-verify markup.

After this change, a .fail.cpp test should always have clang-verify markup.
When clang-verify is not supported by the compiler, we will just check that
these tests fail to compile. When clang-verify is supported, these tests
will be compiled with clang-verify whether they have markup or not (so
they should have markup, or they will fail).

This simplifies the test suite and also ensures that all of our .fail.cpp
tests provide clang-verify markup. If it's impossible for a test to have
clang-verify markup, it can be moved to a .compile.fail.cpp test, which
are unconditionally just checked for compilation failure.
This commit is contained in:
Louis Dionne 2020-04-14 13:00:53 -04:00
parent 443c244cff
commit 7a6aaf9b23
277 changed files with 46 additions and 28 deletions

View File

@ -6,9 +6,10 @@
//
//===----------------------------------------------------------------------===//
// Make sure the test passes if it fails at compile-time, without verify
// Make sure the test passes if we don't have clang-verify support and
// the test fails to compile.
// UNSUPPORTED: verify-support
struct Foo { };
typedef Foo::x x;
int main() { }

View File

@ -8,6 +8,9 @@
// XFAIL: *
// Make sure the test DOES NOT pass if it succeeds at compile-time
// Make sure the test DOES NOT pass if we don't have clang-verify support and
// the test compiles successfully.
// UNSUPPORTED: verify-support
int main() { }

View File

@ -0,0 +1,19 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// XFAIL: *
// Make sure the test DOES NOT pass if there are no diagnostics, but we didn't
// use the 'expected-no-diagnostics' markup.
//
// Note: For the purpose of this test, make sure the file would otherwise
// compile to make sure we really fail due to a lack of markup.
int main() { }

View File

@ -1,4 +1,3 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@ -7,4 +6,9 @@
//
//===----------------------------------------------------------------------===//
#error This test should not compile.
// REQUIRES: verify-support
// Make sure the test passes if we expected no diagnostics and included
// the markup.
// expected-no-diagnostics

View File

@ -6,7 +6,10 @@
//
//===----------------------------------------------------------------------===//
// Make sure the test passes if it fails at compile-time, with verify
// REQUIRES: verify-support
// Make sure the test passes if it fails at compile-time with the expected
// diagnostic.
struct Foo { };
typedef Foo::x x; // expected-error{{no type named 'x' in 'Foo'}}

View File

@ -10,8 +10,7 @@
// XFAIL: *
// Make sure the test DOES NOT pass if it fails at compile-time, but the
// expected-error is wrong.
// Make sure the test DOES NOT pass if the expected diagnostic is wrong.
struct Foo { };
typedef Foo::x x; // expected-error{{this is not found in the errors}}

Some files were not shown because too many files have changed in this diff Show More