[libcxx-commits] [libcxx] 5369d8c - [libc++] Remove support for .run.fail.cpp tests

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 3 12:40:36 PST 2020


Author: Louis Dionne
Date: 2020-11-03T15:40:24-05:00
New Revision: 5369d8cca7e6443703dd4dbaf253012e4c5bb400

URL: https://github.com/llvm/llvm-project/commit/5369d8cca7e6443703dd4dbaf253012e4c5bb400
DIFF: https://github.com/llvm/llvm-project/commit/5369d8cca7e6443703dd4dbaf253012e4c5bb400.diff

LOG: [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).

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/format.py

Removed: 
    libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp
    libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp
    libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp
    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 167676d6629d..000000000000
--- 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 604d74fbe774..000000000000
--- 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 ed8ed9bfe2b7..000000000000
--- 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 f414bc84b682..000000000000
--- 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 53336175bec3..2be7d4c59da2 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 @@ def execute(self, test, litConfig):
                 "%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,


        


More information about the libcxx-commits mailing list