[libcxx-commits] [libcxx] 4d680b0 - [libc++] Add a CI configuration for the modular build

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 8 10:32:25 PDT 2021


Author: Louis Dionne
Date: 2021-06-08T13:32:08-04:00
New Revision: 4d680b06c92a0b785da9bb4370cd7d8819b6d726

URL: https://github.com/llvm/llvm-project/commit/4d680b06c92a0b785da9bb4370cd7d8819b6d726
DIFF: https://github.com/llvm/llvm-project/commit/4d680b06c92a0b785da9bb4370cd7d8819b6d726.diff

LOG: [libc++] Add a CI configuration for the modular build

Differential Revision: https://reviews.llvm.org/D103559

Added: 
    libcxx/cmake/caches/Generic-modules.cmake

Modified: 
    libcxx/test/libcxx/include_as_c.sh.cpp
    libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
    libcxx/utils/ci/buildkite-pipeline.yml
    libcxx/utils/ci/run-buildbot
    libcxx/utils/libcxx/test/config.py
    libcxx/utils/libcxx/test/format.py
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/caches/Generic-modules.cmake b/libcxx/cmake/caches/Generic-modules.cmake
new file mode 100644
index 000000000000..29b4d4be127e
--- /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
index 3fc4f1f07641..9f5ff98d0c95 100644
--- 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
index 65fe65a1a03d..acf557d26e89 100644
--- 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
 
 // <utility>
 

diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index b27222c77380..58272b639879 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -164,6 +164,17 @@ steps:
         - 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
index 64526c8a02d1..a1858c1731c7 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -248,6 +248,13 @@ generic-noexceptions)
     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
index 71880b8ba7e0..4978482006c6 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -132,7 +132,6 @@ def configure(self):
         self.configure_link_flags()
         self.configure_env()
         self.configure_coverage()
-        self.configure_modules()
         self.configure_substitutions()
         self.configure_features()
 
@@ -470,28 +469,6 @@ def configure_coverage(self):
             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
index 72f6d3625037..e4e2937f0a5a 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -225,7 +225,7 @@ def execute(self, test, litConfig):
         #                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
index d2a7309dc47f..5ab82711c1b4 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -77,6 +77,14 @@ def getStdFlag(cfg, std):
               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 [


        


More information about the libcxx-commits mailing list