[libc++] Remove support for .run.fail.cpp tests
authorLouis Dionne <ldionne@apple.com>
Tue, 3 Nov 2020 20:24:00 +0000 (15:24 -0500)
committerLouis Dionne <ldionne@apple.com>
Tue, 3 Nov 2020 20:40:24 +0000 (15:40 -0500)
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).

libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp [deleted file]
libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp [deleted file]
libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp [deleted file]
libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp [deleted file]
libcxx/utils/libcxx/test/format.py

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 (file)
index 167676d..0000000
+++ /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 (file)
index 604d74f..0000000
+++ /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 (file)
index ed8ed9b..0000000
+++ /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 (file)
index f414bc8..0000000
+++ /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;
-}
index 5333617..2be7d4c 100644 (file)
@@ -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,