[libcxx-commits] [libcxx] c15bbde - [libc++] Add a testing configuration specific to Apple's libc++

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 30 07:51:24 PDT 2021


Author: Louis Dionne
Date: 2021-09-30T10:51:13-04:00
New Revision: c15bbdeafffb4a19f511671d1781a64bba638400

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

LOG: [libc++] Add a testing configuration specific to Apple's libc++

Apple's libc++ has a few differences with the LLVM libc++, and it is
necessary to use a custom configuration file to test it properly.

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

Added: 
    libcxx/test/configs/apple-libc++-shared.cfg.in

Modified: 
    libcxx/utils/ci/apple-install-libcxx.sh
    libcxx/utils/ci/run-buildbot

Removed: 
    


################################################################################
diff  --git a/libcxx/test/configs/apple-libc++-shared.cfg.in b/libcxx/test/configs/apple-libc++-shared.cfg.in
new file mode 100644
index 0000000000000..8ae5549a48880
--- /dev/null
+++ b/libcxx/test/configs/apple-libc++-shared.cfg.in
@@ -0,0 +1,70 @@
+ at AUTO_GEN_COMMENT@
+
+ at SERIALIZED_LIT_PARAMS@
+
+#
+# Testing configuration for Apple's system libc++.
+#
+# This configuration 
diff ers from a normal LLVM shared library configuration in
+# that we must use DYLD_LIBRARY_PATH to run the tests against the just-built library,
+# since Apple's libc++ has an absolute install_name.
+#
+# We also don't use a per-target include directory layout, so we have only one
+# include directory for the libc++ headers.
+#
+
+LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
+INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
+COMPILER = "@CMAKE_CXX_COMPILER@"
+EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
+CMAKE_OSX_SYSROOT = "@CMAKE_OSX_SYSROOT@"
+INCLUDE_DIR = "@LIBCXX_INSTALL_INCLUDE_DIR@"
+LIBRARY_DIR = "@LIBCXX_INSTALL_LIBRARY_DIR@"
+
+import os
+import pipes
+import site
+import sys
+site.addsitedir(os.path.join(LIBCXX_ROOT, 'utils'))
+import libcxx.test.features
+import libcxx.test.format
+import libcxx.test.newconfig
+import libcxx.test.params
+
+# Configure basic properties of the test suite
+config.name = 'libcxx-trunk-shared'
+config.test_source_root = os.path.join(LIBCXX_ROOT, 'test')
+config.test_format = libcxx.test.format.CxxStandardLibraryTest()
+config.recursiveExpansionLimit = 10
+config.test_exec_root = EXEC_ROOT
+
+# Configure basic substitutions
+runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
+config.substitutions.append(('%{cxx}', COMPILER))
+config.substitutions.append(('%{flags}',
+    '-isysroot {}'.format(CMAKE_OSX_SYSROOT) if CMAKE_OSX_SYSROOT else ''
+))
+config.substitutions.append(('%{compile_flags}',
+    '-nostdinc++ -isystem {} -I {}'.format(
+        os.path.join(INSTALL_ROOT, INCLUDE_DIR),
+        os.path.join(LIBCXX_ROOT, 'test', 'support'))
+))
+config.substitutions.append(('%{link_flags}',
+    '-nostdlib++ -L {} -lc++'.format(
+        os.path.join(INSTALL_ROOT, LIBRARY_DIR))
+))
+config.substitutions.append(('%{exec}',
+    '{} {} --execdir %T --env DYLD_LIBRARY_PATH={} -- '.format(
+        pipes.quote(sys.executable),
+        pipes.quote(runPy),
+        pipes.quote(os.path.join(INSTALL_ROOT, LIBRARY_DIR)))
+))
+config.substitutions.append(('%{install}', INSTALL_ROOT))
+
+# Add parameters and features to the config
+libcxx.test.newconfig.configure(
+    libcxx.test.params.DEFAULT_PARAMETERS,
+    libcxx.test.features.DEFAULT_FEATURES,
+    config,
+    lit_config
+)

diff  --git a/libcxx/utils/ci/apple-install-libcxx.sh b/libcxx/utils/ci/apple-install-libcxx.sh
index fc672685240ad..c1ce72400e24c 100755
--- a/libcxx/utils/ci/apple-install-libcxx.sh
+++ b/libcxx/utils/ci/apple-install-libcxx.sh
@@ -121,7 +121,8 @@ for arch in ${architectures}; do
             -DCMAKE_INSTALL_NAME_DIR="/usr/lib" \
             -DCMAKE_OSX_ARCHITECTURES="${arch}" \
             -DLIBCXXABI_LIBRARY_VERSION="${version}" \
-            -DLIBCXX_INCLUDE_BENCHMARKS=OFF
+            -DLIBCXX_INCLUDE_BENCHMARKS=OFF \
+            -DLIBCXX_TEST_CONFIG="${llvm_root}/libcxx/test/configs/apple-libc++-shared.cfg.in"
     )
 
     xcrun --sdk "${sdk}" cmake --build "${build_dir}/${arch}" --target install-cxx install-cxxabi -- -v

diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 7bc26d3f30253..41934ef9897f2 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -362,7 +362,7 @@ generic-no-unicode)
 x86_64-apple-system)
     clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
-                   -DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/llvm-libc++-shared.cfg.in"
+                   -DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/apple-libc++-shared.cfg.in"
     check-cxx-cxxabi
 ;;
 x86_64-apple-system-noexceptions)
@@ -370,7 +370,7 @@ x86_64-apple-system-noexceptions)
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
                    -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
                    -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
-                   -DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/llvm-libc++-shared.cfg.in"
+                   -DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/apple-libc++-shared.cfg.in"
     check-cxx-cxxabi
 ;;
 x86_64-apple-system-backdeployment-*)


        


More information about the libcxx-commits mailing list