[libcxx-commits] [libcxx] c504c68 - [libc++] Add a CI configuration with static libc++/libc++abi
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 24 13:31:08 PDT 2021
Author: Louis Dionne
Date: 2021-03-24T16:30:48-04:00
New Revision: c504c68facc925ba76e57b9b606346d428983963
URL: https://github.com/llvm/llvm-project/commit/c504c68facc925ba76e57b9b606346d428983963
DIFF: https://github.com/llvm/llvm-project/commit/c504c68facc925ba76e57b9b606346d428983963.diff
LOG: [libc++] Add a CI configuration with static libc++/libc++abi
Differential Revision: https://reviews.llvm.org/D99268
Added:
libcxx/cmake/caches/Generic-static.cmake
Modified:
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/dsl.py
libcxx/utils/libcxx/test/params.py
Removed:
################################################################################
diff --git a/libcxx/cmake/caches/Generic-static.cmake b/libcxx/cmake/caches/Generic-static.cmake
new file mode 100644
index 0000000000000..4fe910ce4d801
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-static.cmake
@@ -0,0 +1,10 @@
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
+
+# TODO: We should switch this to a from-sratch config with static libraries
+# instead and get rid of these options.
+set(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI OFF CACHE BOOL "")
+set(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX OFF CACHE BOOL "")
+set(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI OFF CACHE BOOL "")
+set(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX OFF CACHE BOOL "")
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 6ef42f36f8585..dfc06fd56455f 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -111,6 +111,17 @@ steps:
- exit_status: -1 # Agent was lost
limit: 2
+ - label: "Static libraries"
+ command: "libcxx/utils/ci/run-buildbot generic-static"
+ artifact_paths:
+ - "**/test-results.xml"
+ agents:
+ queue: "libcxx-builders"
+ retry:
+ automatic:
+ - exit_status: -1 # Agent was lost
+ limit: 2
+
- label: "GCC/C++20"
command: "libcxx/utils/ci/run-buildbot generic-gcc"
artifact_paths:
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index eb48ebd410c99..38d9bc4de0cfe 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -86,14 +86,14 @@ function generate-cmake() {
}
function check-cxx-cxxabi() {
+ echo "--- Installing libc++ and libc++abi to a fake location"
+ ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
+
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
echo "+++ Running the libc++abi tests"
${NINJA} -vC "${BUILD_DIR}" check-cxxabi
-
- echo "--- Installing libc++ and libc++abi to a fake location"
- ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
}
# TODO: The goal is to test this against all configurations. We should also move
@@ -183,6 +183,13 @@ generic-noexceptions)
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake"
check-cxx-cxxabi
;;
+generic-static)
+ export CC=clang
+ export CXX=clang++
+ clean
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
+ check-cxx-cxxabi
+;;
generic-32bit)
export CC=clang
export CXX=clang++
@@ -194,9 +201,7 @@ generic-gcc)
export CC=gcc
export CXX=g++
clean
- # FIXME: Re-enable experimental testing on GCC. GCC cares about the order
- # in which we link -lc++experimental, which causes issues.
- generate-cmake -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
+ generate-cmake
check-cxx-cxxabi
;;
generic-asan)
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 955ef7979c7e4..57b729be0612f 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -124,7 +124,7 @@ def configure(self):
self.configure_obj_root()
self.cxx_stdlib_under_test = self.get_lit_conf('cxx_stdlib_under_test', 'libc++')
self.cxx_library_root = self.get_lit_conf('cxx_library_root', self.libcxx_obj_root)
- self.abi_library_root = self.get_lit_conf('abi_library_root', None)
+ self.abi_library_root = self.get_lit_conf('abi_library_root') or self.cxx_library_root
self.cxx_runtime_root = self.get_lit_conf('cxx_runtime_root', self.cxx_library_root)
self.abi_runtime_root = self.get_lit_conf('abi_runtime_root', self.abi_library_root)
self.configure_compile_flags()
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 012d13aa2d777..7f4dcec8e91b6 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -211,9 +211,12 @@ def featureTestMacros(config, flags=''):
return {m: int(v.rstrip('LlUu')) for (m, v) in allMacros.items() if m.startswith('__cpp_')}
-def _addToSubstitution(substitutions, key, value):
+def _appendToSubstitution(substitutions, key, value):
return [(k, v + ' ' + value) if k == key else (k, v) for (k, v) in substitutions]
+def _prependToSubstitution(substitutions, key, value):
+ return [(k, value + ' ' + v) if k == key else (k, v) for (k, v) in substitutions]
+
class ConfigAction(object):
"""
@@ -285,7 +288,7 @@ def __init__(self, flag):
def applyTo(self, config):
flag = self._getFlag(config)
assert hasCompileFlag(config, flag), "Trying to enable flag {}, which is not supported".format(flag)
- config.substitutions = _addToSubstitution(config.substitutions, '%{flags}', flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{flags}', flag)
def pretty(self, config, litParams):
return 'add {} to %{{flags}}'.format(self._getFlag(config))
@@ -304,7 +307,7 @@ def __init__(self, flag):
def applyTo(self, config):
flag = self._getFlag(config)
assert hasCompileFlag(config, flag), "Trying to enable compile flag {}, which is not supported".format(flag)
- config.substitutions = _addToSubstitution(config.substitutions, '%{compile_flags}', flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{compile_flags}', flag)
def pretty(self, config, litParams):
return 'add {} to %{{compile_flags}}'.format(self._getFlag(config))
@@ -312,7 +315,26 @@ def pretty(self, config, litParams):
class AddLinkFlag(ConfigAction):
"""
- This action adds the given flag to the %{link_flags} substitution.
+ This action appends the given flag to the %{link_flags} substitution.
+
+ The flag can be a string or a callable, in which case it is called with the
+ configuration to produce the actual flag (as a string).
+ """
+ def __init__(self, flag):
+ self._getFlag = lambda config: flag(config) if callable(flag) else flag
+
+ def applyTo(self, config):
+ flag = self._getFlag(config)
+ assert hasCompileFlag(config, flag), "Trying to enable link flag {}, which is not supported".format(flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{link_flags}', flag)
+
+ def pretty(self, config, litParams):
+ return 'append {} to %{{link_flags}}'.format(self._getFlag(config))
+
+
+class PrependLinkFlag(ConfigAction):
+ """
+ This action prepends the given flag to the %{link_flags} substitution.
The flag can be a string or a callable, in which case it is called with the
configuration to produce the actual flag (as a string).
@@ -323,10 +345,10 @@ def __init__(self, flag):
def applyTo(self, config):
flag = self._getFlag(config)
assert hasCompileFlag(config, flag), "Trying to enable link flag {}, which is not supported".format(flag)
- config.substitutions = _addToSubstitution(config.substitutions, '%{link_flags}', flag)
+ config.substitutions = _prependToSubstitution(config.substitutions, '%{link_flags}', flag)
def pretty(self, config, litParams):
- return 'add {} to %{{link_flags}}'.format(self._getFlag(config))
+ return 'prepend {} to %{{link_flags}}'.format(self._getFlag(config))
class AddOptionalWarningFlag(ConfigAction):
@@ -344,7 +366,7 @@ def applyTo(self, config):
flag = self._getFlag(config)
# Use -Werror to make sure we see an error about the flag being unsupported.
if hasCompileFlag(config, '-Werror ' + flag):
- config.substitutions = _addToSubstitution(config.substitutions, '%{compile_flags}', flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{compile_flags}', flag)
def pretty(self, config, litParams):
return 'add {} to %{{compile_flags}}'.format(self._getFlag(config))
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index fef2543f0b6f5..99bd1f45b196b 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -90,7 +90,7 @@
help="Whether to enable tests for experimental C++ libraries (typically Library Fundamentals TSes).",
actions=lambda experimental: [] if not experimental else [
AddFeature('c++experimental'),
- AddLinkFlag('-lc++experimental')
+ PrependLinkFlag('-lc++experimental')
]),
Parameter(name='long_tests', choices=[True, False], type=bool, default=True,
More information about the libcxx-commits
mailing list