-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[libc++] Enable additional tests when Clang modules are enabled #168967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ldionne
wants to merge
1
commit into
llvm:main
Choose a base branch
from
ldionne:review/fno-modules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Disabling tests when Clang modules are enabled is not great because we are moving more and more tests towards using Clang modules by default. Instead, disable Clang modules on a per-test basis.
Member
Author
|
@philnik777 We talked about this |
Member
|
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesDisabling tests when Clang modules are enabled is not great because we are moving more and more tests towards using Clang modules by default. Instead, disable Clang modules on a per-test basis. Full diff: https://github.com/llvm/llvm-project/pull/168967.diff 23 Files Affected:
diff --git a/libcxx/test/extensions/libcxx/depr/depr.c.headers/extern_c.pass.cpp b/libcxx/test/extensions/libcxx/depr/depr.c.headers/extern_c.pass.cpp
index 33b55c4bb195a..b7bdd841ea3e0 100644
--- a/libcxx/test/extensions/libcxx/depr/depr.c.headers/extern_c.pass.cpp
+++ b/libcxx/test/extensions/libcxx/depr/depr.c.headers/extern_c.pass.cpp
@@ -8,7 +8,7 @@
// When building with modules, including headers inside extern "C" is an anti-pattern
// that we don't want to support and can't support with LSV enabled.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// Sometimes C++'s <foo.h> headers get included within extern "C" contexts. This
// is ill-formed (no diagnostic required), per [using.headers]p3, but we permit
diff --git a/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_as_c.sh.cpp b/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_as_c.sh.cpp
index 635c7e3aa4f5f..dd9847f63253b 100644
--- a/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_as_c.sh.cpp
+++ b/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_as_c.sh.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// We're building as C, so this test doesn't work when building with modules.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// GCC complains about unrecognized arguments because we're compiling the
// file as C, but we're passing C++ flags on the command-line.
diff --git a/libcxx/test/extensions/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp b/libcxx/test/extensions/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
index 75a4ab908ce21..f665ec5a1b5db 100644
--- a/libcxx/test/extensions/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
+++ b/libcxx/test/extensions/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// This test breaks when enabling LSV.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// Test that limits macros are available when <stdint.h> is included
// with or without macro _XOPEN_SOURCE=700.
diff --git a/libcxx/test/extensions/posix/xopen_source.gen.py b/libcxx/test/extensions/posix/xopen_source.gen.py
index ec0d981d67b2b..bea11e2c04ceb 100644
--- a/libcxx/test/extensions/posix/xopen_source.gen.py
+++ b/libcxx/test/extensions/posix/xopen_source.gen.py
@@ -15,7 +15,7 @@
# Some parts of the code like <fstream> use non-standard functions in their implementation,
# and these functions are not provided when _XOPEN_SOURCE is set to older values. This
# breaks when building with modules even when we don't use the offending headers directly.
-# UNSUPPORTED: clang-modules-build
+# ADDITIONAL_COMPILE_FLAGS: -fno-modules
# The AIX localization support uses some functions as part of their headers that require a
# recent value of _XOPEN_SOURCE.
diff --git a/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
index 69154c3f7eaff..bb44bc68eb1ce 100644
--- a/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
+++ b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// This compile-time customization requires cross-file macros, which doesn't work with modules.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// Make sure that we can customize the verbose termination function at compile-time by
// defining _LIBCPP_VERBOSE_ABORT ourselves. Note that this does not have any
diff --git a/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp b/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp
index 751ff7247445f..4f0abd8ab9d07 100644
--- a/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp
+++ b/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -9,10 +9,11 @@
// This test verifies that setting the hardening mode to a value that's not part of the predefined constants triggers
// a compile-time error.
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
// REQUIRES: verify-support
+// TODO: Investigate
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// Note that GCC doesn't support `-Wno-macro-redefined`.
// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=42
// Make sure that common cases of misuse produce readable errors. We deliberately disallow setting the hardening mode as
diff --git a/libcxx/test/libcxx-03/transitive_includes.gen.py b/libcxx/test/libcxx-03/transitive_includes.gen.py
index 6f99240436632..3ab9986bdb94c 100644
--- a/libcxx/test/libcxx-03/transitive_includes.gen.py
+++ b/libcxx/test/libcxx-03/transitive_includes.gen.py
@@ -77,7 +77,7 @@
// When built with modules, this test doesn't work because --trace-includes doesn't
// report the stack of includes correctly.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// This test uses --trace-includes, which is not supported by GCC.
// UNSUPPORTED: gcc
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
index 1f5dae1232e37..65ae7de663162 100644
--- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
@@ -8,7 +8,7 @@
// The test suite needs to define the ABI macros on the command line when
// modules are enabled.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// <utility>
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp
index 162a3539d2308..f0da45d9bd281 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp
@@ -7,11 +7,13 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// In the modules build, adding another overload of `memmove` doesn't work.
-// UNSUPPORTED: clang-modules-build
+
// GCC complains about "ambiguating" `__builtin_memmove`.
// UNSUPPORTED: gcc
+// In the modules build, adding another overload of `memmove` doesn't work.
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// <algorithm>
#include <cassert>
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp
index ff10c7919200d..e009438acb005 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp
@@ -7,11 +7,13 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// In the modules build, adding another overload of `memmove` doesn't work.
-// UNSUPPORTED: clang-modules-build
+
// GCC complains about "ambiguating" `__builtin_memmove`.
// UNSUPPORTED: gcc
+// In the modules build, adding another overload of `memmove` doesn't work.
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// <algorithm>
// These tests check that `std::copy` and `std::move` (including their variations like `copy_n`) forward to
diff --git a/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp b/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp
index 69154c3f7eaff..bb44bc68eb1ce 100644
--- a/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp
+++ b/libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// This compile-time customization requires cross-file macros, which doesn't work with modules.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// Make sure that we can customize the verbose termination function at compile-time by
// defining _LIBCPP_VERBOSE_ABORT ourselves. Note that this does not have any
diff --git a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
index 751ff7247445f..4f0abd8ab9d07 100644
--- a/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
+++ b/libcxx/test/libcxx/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -9,10 +9,11 @@
// This test verifies that setting the hardening mode to a value that's not part of the predefined constants triggers
// a compile-time error.
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
// REQUIRES: verify-support
+// TODO: Investigate
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// Note that GCC doesn't support `-Wno-macro-redefined`.
// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=42
// Make sure that common cases of misuse produce readable errors. We deliberately disallow setting the hardening mode as
diff --git a/libcxx/test/libcxx/assertions/semantics/assertion_semantic_incorrect_value.sh.cpp b/libcxx/test/libcxx/assertions/semantics/assertion_semantic_incorrect_value.sh.cpp
index d7c1e26491ba9..67a0ed5aaa408 100644
--- a/libcxx/test/libcxx/assertions/semantics/assertion_semantic_incorrect_value.sh.cpp
+++ b/libcxx/test/libcxx/assertions/semantics/assertion_semantic_incorrect_value.sh.cpp
@@ -9,11 +9,12 @@
// This test verifies that setting the assertion semantic to a value that's not part of the predefined constants
// triggers a compile-time error.
-// Modules build produces a different error ("Could not build module 'std'").
-// UNSUPPORTED: clang-modules-build
// UNSUPPORTED: c++03, libcpp-has-no-experimental-hardening-observe-semantic
// REQUIRES: verify-support
+// TODO: Investigate
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// RUN: %{verify} -U_LIBCPP_ASSERTION_SEMANTIC -D_LIBCPP_ASSERTION_SEMANTIC=42
// `hardening-dependent` cannot be set as the semantic (it's only an indicator to use hardening-related logic to pick
// the final semantic).
diff --git a/libcxx/test/libcxx/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp b/libcxx/test/libcxx/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp
index b92f2baa02e47..10939ab91c69b 100644
--- a/libcxx/test/libcxx/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp
+++ b/libcxx/test/libcxx/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp
@@ -11,7 +11,7 @@
// When built with modules, this test gives diagnostics like declaration of
// 'unexpected' must be imported from module 'std.expected.unexpected' before
// it is required. Therefore disable it in this configuration.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// test unexpected
diff --git a/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp b/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp
index 134978d099ecf..7eafb77c2de9c 100644
--- a/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp
+++ b/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// This test breaks when enabling LSV.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// UNSUPPORTED: c++03, c++11, c++14
diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py
index 2b643e1f2ad48..8995482778d43 100644
--- a/libcxx/test/libcxx/transitive_includes.gen.py
+++ b/libcxx/test/libcxx/transitive_includes.gen.py
@@ -75,7 +75,7 @@
// When built with modules, this test doesn't work because --trace-includes doesn't
// report the stack of includes correctly.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// This test uses --trace-includes, which is not supported by GCC.
// UNSUPPORTED: gcc
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
index 1f5dae1232e37..65ae7de663162 100644
--- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
@@ -8,7 +8,7 @@
// The test suite needs to define the ABI macros on the command line when
// modules are enabled.
-// UNSUPPORTED: clang-modules-build
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
// <utility>
diff --git a/libcxx/test/selftest/modules/std-and-std.compat-module.sh.cpp b/libcxx/test/selftest/modules/std-and-std.compat-module.sh.cpp
index 455674d6b9949..f61e8493c61cf 100644
--- a/libcxx/test/selftest/modules/std-and-std.compat-module.sh.cpp
+++ b/libcxx/test/selftest/modules/std-and-std.compat-module.sh.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
// UNSUPPORTED: gcc
// TODO: This test is currently written in a way that is specific to libc++, but it's really trying to test a property
@@ -20,6 +19,9 @@
// The tests only look for the expected components and not the exact flags.
// Otherwise changing the location of the module would break this test.
+// C++20 modules are incompatible with Clang modules
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// MODULE_DEPENDENCIES: std std.compat
// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std=.*/std.pcm .*/std.pcm"
diff --git a/libcxx/test/selftest/modules/std-module.sh.cpp b/libcxx/test/selftest/modules/std-module.sh.cpp
index e96c1e64b7275..ea9dbd5808937 100644
--- a/libcxx/test/selftest/modules/std-module.sh.cpp
+++ b/libcxx/test/selftest/modules/std-module.sh.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
// UNSUPPORTED: gcc
// TODO: This test is currently written in a way that is specific to libc++, but it's really trying to test a property
@@ -20,6 +19,9 @@
// The tests only look for the expected components and not the exact flags.
// Otherwise changing the location of the module would break this test.
+// C++20 modules are incompatible with Clang modules
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// MODULE_DEPENDENCIES: std
// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std=.*/std.pcm .*/std.pcm"
diff --git a/libcxx/test/selftest/modules/std.compat-module.sh.cpp b/libcxx/test/selftest/modules/std.compat-module.sh.cpp
index 4ec0ad8323d8d..8bce59b99279b 100644
--- a/libcxx/test/selftest/modules/std.compat-module.sh.cpp
+++ b/libcxx/test/selftest/modules/std.compat-module.sh.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
// UNSUPPORTED: gcc
// TODO: This test is currently written in a way that is specific to libc++, but it's really trying to test a property
@@ -16,6 +15,9 @@
// XFAIL: has-no-cxx-module-support
+// C++20 modules are incompatible with Clang modules
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// Make sure that the compile flags contain the expected elements.
// The tests only look for the expected components and not the exact flags.
// Otherwise changing the location of the module would break this test.
diff --git a/libcxx/test/std/modules/std.compat.pass.cpp b/libcxx/test/std/modules/std.compat.pass.cpp
index e840f3c6b629c..0d1a4ac7d89c4 100644
--- a/libcxx/test/std/modules/std.compat.pass.cpp
+++ b/libcxx/test/std/modules/std.compat.pass.cpp
@@ -7,13 +7,15 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-modules-build
// UNSUPPORTED: gcc
// XFAIL: has-no-cxx-module-support
// A minimal test to validate import works.
+// C++20 modules are incompatible with Clang modules
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// MODULE_DEPENDENCIES: std.compat
import std.compat;
diff --git a/libcxx/test/std/modules/std.pass.cpp b/libcxx/test/std/modules/std.pass.cpp
index ca05825b3a186..4587dcb1b8178 100644
--- a/libcxx/test/std/modules/std.pass.cpp
+++ b/libcxx/test/std/modules/std.pass.cpp
@@ -7,13 +7,15 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
// UNSUPPORTED: gcc
// XFAIL: has-no-cxx-module-support
// A minimal test to validate import works.
+// C++20 modules are incompatible with Clang modules
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// MODULE_DEPENDENCIES: std
import std;
diff --git a/libcxx/utils/libcxx/test/modules.py b/libcxx/utils/libcxx/test/modules.py
index bd4fbe78c1cdc..f70d976705d60 100644
--- a/libcxx/utils/libcxx/test/modules.py
+++ b/libcxx/utils/libcxx/test/modules.py
@@ -118,13 +118,15 @@ def write_lit_configuration(self):
print(
f"""\
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-modules-build
// REQUIRES: has-clang-tidy
// The GCC compiler flags are not always compatible with clang-tidy.
// UNSUPPORTED: gcc
+// C++20 modules are incompatible with Clang modules
+// ADDITIONAL_COMPILE_FLAGS: -fno-modules
+
// MODULE_DEPENDENCIES: {self.module}
// RUN: echo -n > {self.tmp_prefix}.all_partitions
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disabling tests when Clang modules are enabled is not great because we are moving more and more tests towards using Clang modules by default. Instead, disable Clang modules on a per-test basis.