[libcxx-commits] [libcxx] 8c06061 - [libc++abi] Add a from-scratch testing config for Apple backdeployment

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 14 12:36:54 PST 2022


Author: Louis Dionne
Date: 2022-02-14T15:36:50-05:00
New Revision: 8c060613721c5e7b52f43e7d1da24346b0506dde

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

LOG: [libc++abi] Add a from-scratch testing config for Apple backdeployment

We added one for libc++ recently, and this patch adds one for libc++abi.
Also, as a fly-by fix, include older libunwind dylibs in the testing of
libc++ and libc++abi, which fixes some issues related to running
back-deployment tests on newer systems.

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

Added: 
    libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in

Modified: 
    libcxx/test/configs/apple-libc++-backdeployment.cfg.in
    libcxx/utils/ci/run-buildbot
    libcxxabi/test/test_exception_address_alignment.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
index 7e0e1c2e06880..b78a64f056607 100644
--- a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
+++ b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
@@ -30,6 +30,15 @@ BACKDEPLOYMENT_PARAMETERS = [
         The dylib in that hierarchy is the one that will be used at runtime when running
         the tests.
         """),
+    libcxx.test.dsl.Parameter(name='unwind_runtime_root', type=str,
+        actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{unwind-runtime-root}', root)],
+        help="""
+        The simulated root of the system (for libunwind) when running tests.
+
+        This should be a directory hierarchy under which the libunwind dylib can be found.
+        The dylib in that hierarchy is the one that will be used at runtime when running
+        the tests.
+        """),
 ]
 
 config.substitutions.append(('%{flags}',
@@ -42,7 +51,7 @@ config.substitutions.append(('%{link_flags}',
     '-nostdlib++ -L %{install}/lib -lc++'
 ))
 config.substitutions.append(('%{exec}',
-    '%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}" -- '
+    '%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}:%{unwind-runtime-root}" -- '
 ))
 
 libcxx.test.newconfig.configure(

diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index b8bebe4daa163..0db8fc44f8b6b 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -444,10 +444,13 @@ apple-system-backdeployment-*)
     PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
     PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
     PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
+    PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
     PARAMS+=";use_system_cxx_lib=True"
 
+    # TODO: We should run the libunwind tests using the back-deployment dylibs too.
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
                    -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
+                   -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
                    -DLIBCXX_TEST_PARAMS="${PARAMS}" \
                    -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
 

diff  --git a/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in b/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in
new file mode 100644
index 0000000000000..9239c550b744b
--- /dev/null
+++ b/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in
@@ -0,0 +1,63 @@
+# Testing configuration for back-deployment against older Apple system libc++abi.
+#
+# Under this configuration, we compile and link all the test suite against the latest libc++abi,
+# however we run against the libc++abi on a 
diff erent platform. This emulates the workflow of
+# a developer building their application using recent tools but with the goal of deploying
+# on existing devices running an older OS (and hence an older dylib).
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
+import libcxx.test.params, libcxx.test.newconfig, libcxx.test.dsl
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+BACKDEPLOYMENT_PARAMETERS = [
+    libcxx.test.dsl.Parameter(name='cxx_runtime_root', type=str,
+        actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{cxx-runtime-root}', root)],
+        help="""
+        The simulated root of the system (for libc++) when running tests.
+
+        This should be a directory hierarchy under which the libc++ dylib can be found.
+        The dylib in that hierarchy is the one that will be used at runtime when running
+        the tests.
+        """),
+    libcxx.test.dsl.Parameter(name='abi_runtime_root', type=str,
+        actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{abi-runtime-root}', root)],
+        help="""
+        The simulated root of the system (for libc++abi) when running tests.
+
+        This should be a directory hierarchy under which the libc++abi dylib can be found.
+        The dylib in that hierarchy is the one that will be used at runtime when running
+        the tests.
+        """),
+    libcxx.test.dsl.Parameter(name='unwind_runtime_root', type=str,
+        actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{unwind-runtime-root}', root)],
+        help="""
+        The simulated root of the system (for libunwind) when running tests.
+
+        This should be a directory hierarchy under which the libunwind dylib can be found.
+        The dylib in that hierarchy is the one that will be used at runtime when running
+        the tests.
+        """),
+]
+
+config.substitutions.append(('%{flags}',
+    '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
+))
+config.substitutions.append(('%{compile_flags}',
+    '-nostdinc++ -isystem %{install}/include/c++/v1 -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
+    '-I %{libcxx}/test/support -I %{libcxx}/src'
+))
+config.substitutions.append(('%{link_flags}',
+    '-nostdlib++ -L %{install}/lib -lc++ -lc++abi'
+))
+config.substitutions.append(('%{exec}',
+    '%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}:%{unwind-runtime-root}" -- '
+))
+
+libcxx.test.newconfig.configure(
+    libcxx.test.params.DEFAULT_PARAMETERS + BACKDEPLOYMENT_PARAMETERS,
+    libcxx.test.features.DEFAULT_FEATURES,
+    config,
+    lit_config
+)

diff  --git a/libcxxabi/test/test_exception_address_alignment.pass.cpp b/libcxxabi/test/test_exception_address_alignment.pass.cpp
index f684d3a9307ab..edfa78930a69f 100644
--- a/libcxxabi/test/test_exception_address_alignment.pass.cpp
+++ b/libcxxabi/test/test_exception_address_alignment.pass.cpp
@@ -11,9 +11,8 @@
 
 // The <unwind.h> header provided in the SDK of older Xcodes used to provide
 // an incorrectly aligned _Unwind_Exception type on non-ARM. That causes these
-// tests to fail when compiling against such a SDK, or when running against a
-// system libc++abi that was compiled with an incorrect definition of _Unwind_Exception.
-// XFAIL: apple-clang-12.0.0 && !target={{arm.*}}
+// tests to fail when running against a system libc++abi and libunwind that was
+// compiled with an incorrect definition of _Unwind_Exception.
 // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12}}
 
 // Test that the address of the exception object is properly aligned as required


        


More information about the libcxx-commits mailing list