From 5369d8cca7e6443703dd4dbaf253012e4c5bb400 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 3 Nov 2020 15:24:00 -0500 Subject: [PATCH] [libc++] Remove support for .run.fail.cpp tests Unfortunately, executing these tests correctly on platforms that do not support a shell is very challenging. Since the executor can't just negate the result of the command, we'd have to ship a portable program capable of running the actual test executable, and negating its result. Doing this portably is challenging. Since we do not currently have strong use cases for tests that fail at runtime (we effectively have no tests using that capability right now), it is difficult to justify making them work portably. Instead, it makes more sense to remove this feature until we can implement it properly (i.e. without requiring shell support). --- .../selftest/run.fail.cpp/compile-error.run.fail.cpp | 18 ------------------ .../selftest/run.fail.cpp/link-error.run.fail.cpp | 18 ------------------ .../selftest/run.fail.cpp/run-error.run.fail.cpp | 13 ------------- .../selftest/run.fail.cpp/run-success.run.fail.cpp | 15 --------------- libcxx/utils/libcxx/test/format.py | 9 +-------- 5 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp delete mode 100644 libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp delete mode 100644 libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp delete mode 100644 libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp diff --git a/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp deleted file mode 100644 index 167676d..0000000 --- a/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// XFAIL: * - -// Make sure the test DOES NOT pass if it fails at compile-time - -struct Foo { }; -typedef Foo::x x; - -int main(int, char**) { - return 1; -} diff --git a/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp deleted file mode 100644 index 604d74f..0000000 --- a/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// XFAIL: * - -// Make sure that the test DOES NOT pass if it fails at link-time - -extern void this_is_an_undefined_symbol(); - -int main(int, char**) { - this_is_an_undefined_symbol(); - return 1; -} diff --git a/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp deleted file mode 100644 index ed8ed9b..0000000 --- a/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Make sure the test passes if it fails at runtime. - -int main(int, char**) { - return 1; -} diff --git a/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp deleted file mode 100644 index f414bc8..0000000 --- a/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// XFAIL: * - -// Make sure the test DOES NOT pass if it succeeds at runtime. - -int main(int, char**) { - return 0; -} diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py index 5333617..2be7d4c 100644 --- a/libcxx/utils/libcxx/test/format.py +++ b/libcxx/utils/libcxx/test/format.py @@ -122,7 +122,6 @@ class CxxStandardLibraryTest(lit.formats.TestFormat): FOO.pass.cpp - Compiles, links and runs successfully FOO.pass.mm - Same as .pass.cpp, but for Objective-C++ - FOO.run.fail.cpp - Compiles and links successfully, but fails at runtime FOO.compile.pass.cpp - Compiles successfully, link and run not attempted FOO.compile.fail.cpp - Does not compile successfully @@ -196,7 +195,7 @@ class CxxStandardLibraryTest(lit.formats.TestFormat): in conjunction with the %{build} substitution. """ def getTestsInDirectory(self, testSuite, pathInSuite, litConfig, localConfig): - SUPPORTED_SUFFIXES = ['[.]pass[.]cpp$', '[.]pass[.]mm$', '[.]run[.]fail[.]cpp$', + SUPPORTED_SUFFIXES = ['[.]pass[.]cpp$', '[.]pass[.]mm$', '[.]compile[.]pass[.]cpp$', '[.]compile[.]fail[.]cpp$', '[.]link[.]pass[.]cpp$', '[.]link[.]fail[.]cpp$', '[.]sh[.][^.]+$', @@ -255,12 +254,6 @@ class CxxStandardLibraryTest(lit.formats.TestFormat): "%dbg(LINKED WITH) ! %{cxx} %t.o %{flags} %{link_flags} -o %t.exe" ] return self._executeShTest(test, litConfig, steps) - elif filename.endswith('.run.fail.cpp'): - steps = [ - "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe", - "%dbg(EXECUTED AS) %{exec} ! %t.exe" - ] - return self._executeShTest(test, litConfig, steps) elif filename.endswith('.verify.cpp'): if not supportsVerify: return lit.Test.Result(lit.Test.UNSUPPORTED, -- 2.7.4