diff --git a/libcxx/cmake/caches/Generic-modules.cmake b/libcxx/cmake/caches/Generic-modules.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/Generic-modules.cmake @@ -0,0 +1,2 @@ +set(LIBCXX_TEST_PARAMS "enable_modules=True" CACHE STRING "") +set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "") diff --git a/libcxx/test/libcxx/include_as_c.sh.cpp b/libcxx/test/libcxx/include_as_c.sh.cpp --- a/libcxx/test/libcxx/include_as_c.sh.cpp +++ b/libcxx/test/libcxx/include_as_c.sh.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // We're building as C, so this test doesn't work when building with modules. -// UNSUPPORTED: -fmodules +// UNSUPPORTED: modules-build // 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/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp --- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp +++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp @@ -8,7 +8,7 @@ // The test suite needs to define the ABI macros on the command line when // modules are enabled. -// UNSUPPORTED: -fmodules +// UNSUPPORTED: modules-build // diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -164,6 +164,17 @@ - exit_status: -1 # Agent was lost limit: 2 + - label: "Modular build" + command: "libcxx/utils/ci/run-buildbot generic-modules" + artifact_paths: + - "**/test-results.xml" + agents: + queue: "libcxx-builders" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + - label: "Static libraries" command: "libcxx/utils/ci/run-buildbot generic-static" artifact_paths: diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -248,6 +248,13 @@ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake" check-cxx-cxxabi ;; +generic-modules) + export CC=clang + export CXX=clang++ + clean + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" + check-cxx-cxxabi +;; generic-static) export CC=clang export CXX=clang++ diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py --- a/libcxx/utils/libcxx/test/config.py +++ b/libcxx/utils/libcxx/test/config.py @@ -132,7 +132,6 @@ self.configure_link_flags() self.configure_env() self.configure_coverage() - self.configure_modules() self.configure_substitutions() self.configure_features() @@ -470,28 +469,6 @@ self.cxx.flags += ['-g', '--coverage'] self.cxx.compile_flags += ['-O0'] - def configure_modules(self): - modules_flags = ['-fmodules', '-Xclang', '-fmodules-local-submodule-visibility'] - supports_modules = self.cxx.hasCompileFlag(modules_flags) - enable_modules = self.get_lit_bool('enable_modules', default=False, - env_var='LIBCXX_ENABLE_MODULES') - if enable_modules and not supports_modules: - self.lit_config.fatal( - '-fmodules is enabled but not supported by the compiler') - if not supports_modules: - return - module_cache = os.path.join(self.config.test_exec_root, - 'modules.cache') - module_cache = os.path.realpath(module_cache) - if os.path.isdir(module_cache): - shutil.rmtree(module_cache) - os.makedirs(module_cache) - self.cxx.modules_flags += modules_flags + \ - ['-fmodules-cache-path=' + module_cache] - if enable_modules: - self.config.available_features.add('-fmodules') - self.cxx.useModules() - def quote(self, s): if platform.system() == 'Windows': return lit.TestRunner.quote_windows_command([s]) diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py --- a/libcxx/utils/libcxx/test/format.py +++ b/libcxx/utils/libcxx/test/format.py @@ -225,7 +225,7 @@ # split the part that does a death test outside of the # test, and only disable that part when modules are # enabled. - if '-fmodules' in test.config.available_features and self._disableWithModules(test): + if 'modules-build' in test.config.available_features and self._disableWithModules(test): return lit.Test.Result(lit.Test.UNSUPPORTED, 'Test {} is unsupported when modules are enabled') if re.search('[.]sh[.][^.]+$', filename): diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -77,6 +77,14 @@ AddCompileFlag(lambda cfg: getStdFlag(cfg, std)), ]), + Parameter(name='enable_modules', choices=[True, False], type=bool, default=False, + help="Whether to build the test suite with Clang modules enabled.", + actions=lambda modules: [ + AddFeature('modules-build'), + AddCompileFlag('-fmodules'), + AddCompileFlag('-Xclang -fmodules-local-submodule-visibility'), + ] if modules else []), + Parameter(name='enable_exceptions', choices=[True, False], type=bool, default=True, help="Whether to enable exceptions when compiling the test suite.", actions=lambda exceptions: [] if exceptions else [