Skip to content

Commit 4d79ef8

Browse files
committed
Allow running back-deployment testing against libc++abi
Summary: Before this patch, we could only link against the back-deployment libc++abi dylib. This patch allows linking against the just-built libc++abi, but running against the back-deployment one -- just like we do for libc++. Also, add XFAIL markup to flag expected errors.
1 parent d8d1cc6 commit 4d79ef8

24 files changed

+123
-40
lines changed

libcxx/test/configs/legacy.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config.project_obj_root = "@CMAKE_BINARY_DIR@"
88
config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
99
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
1010
config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
11+
config.abi_library_root = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
1112
config.enable_exceptions = @LIBCXX_ENABLE_EXCEPTIONS@
1213
config.enable_debug_tests = @LIBCXX_ENABLE_DEBUG_MODE_SUPPORT@
1314
config.enable_experimental = @LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@
@@ -18,7 +19,6 @@ config.enable_32bit = @LIBCXX_BUILD_32_BITS@
1819
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
1920
config.use_sanitizer = "@LLVM_USE_SANITIZER@"
2021
config.sanitizer_library = "@LIBCXX_SANITIZER_LIBRARY@"
21-
config.abi_library_path = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
2222
config.configuration_variant = "@LIBCXX_LIT_VARIANT@"
2323
config.host_triple = "@LLVM_HOST_TRIPLE@"
2424
config.target_triple = "@TARGET_TRIPLE@"

libcxx/utils/ci/macos-backdeployment.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@ fi
120120
LIBCXX_ROOT_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/libc++/${DEPLOYMENT_TARGET}"
121121
LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
122122

123+
# TODO: On Apple platforms, we never produce libc++abi.1.dylib, always libc++abi.dylib.
124+
# Fix that in the build so that the tests stop searching for @rpath/libc++abi.1.dylib.
125+
cp "${LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET}/libc++abi.dylib" "${LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET}/libc++abi.1.dylib"
126+
123127
# Filesystem is supported on Apple platforms starting with macosx10.15.
124128
if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then
125129
ENABLE_FILESYSTEM="--param enable_filesystem=false"
126130
else
127131
ENABLE_FILESYSTEM="--param enable_filesystem=true"
128132
fi
129133

130-
# TODO: We need to also run the tests for libc++abi.
131-
echo "@@@ Running tests for libc++ @@@"
132-
"${LLVM_BUILD_DIR}/bin/llvm-lit" -sv "${MONOREPO_ROOT}/libcxx/test" \
134+
echo "@@@ Running tests for libc++ and libc++abi @@@"
135+
"${LLVM_BUILD_DIR}/bin/llvm-lit" -sv "${MONOREPO_ROOT}/libcxx/test" "${MONOREPO_ROOT}/libcxxabi/test" \
133136
--param=enable_experimental=false \
134137
--param=enable_debug_tests=false \
135138
${ENABLE_FILESYSTEM} \
@@ -138,7 +141,8 @@ echo "@@@ Running tests for libc++ @@@"
138141
--param=target_triple="x86_64-apple-macosx${DEPLOYMENT_TARGET}" \
139142
--param=cxx_library_root="${LLVM_INSTALL_DIR}/lib" \
140143
--param=cxx_runtime_root="${LIBCXX_ROOT_ON_DEPLOYMENT_TARGET}" \
141-
--param=abi_library_path="${LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET}" \
144+
--param=abi_library_root="${LLVM_INSTALL_DIR}/lib" \
145+
--param=abi_runtime_root="${LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET}" \
142146
--param=use_system_cxx_lib="True" \
143147
${ADDITIONAL_LIT_ARGS}
144148
echo "@@@@@@"

libcxx/utils/ci/run-buildbot

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,15 @@ x86_64-apple-system-backdeployment-*)
243243
fi
244244

245245
DEPLOYMENT_TARGET="${BUILDER#x86_64-apple-system-backdeployment-}"
246+
247+
# TODO: On Apple platforms, we never produce libc++abi.1.dylib, always libc++abi.dylib.
248+
# Fix that in the build so that the tests stop searching for @rpath/libc++abi.1.dylib.
249+
cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
250+
"${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
251+
246252
PARAMS="target_triple=x86_64-apple-macosx${DEPLOYMENT_TARGET}"
247253
PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
248-
PARAMS+=";abi_library_path=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
254+
PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
249255
PARAMS+=";use_system_cxx_lib=True"
250256
# Filesystem is supported on Apple platforms starting with macosx10.15.
251257
if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then
@@ -258,9 +264,7 @@ x86_64-apple-system-backdeployment-*)
258264
-DLIBCXX_TEST_PARAMS="${PARAMS}" \
259265
-DLIBCXXABI_TEST_PARAMS="${PARAMS}"
260266

261-
# TODO: Also run the libc++abi tests
262-
echo "+++ Running the libc++ tests"
263-
ninja -C "${BUILD_DIR}" check-cxx
267+
check-cxx-cxxabi
264268
;;
265269
benchmarks)
266270
export CC=clang

libcxx/utils/libcxx/compiler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(self, config, path, flags=None, compile_flags=None, link_flags=None
2929
self.flags = list(flags or [])
3030
self.compile_flags = list(compile_flags or [])
3131
self.link_flags = list(link_flags or [])
32-
self.link_libcxxabi_flag = '-lc++abi'
3332
self.warning_flags = list(warning_flags or [])
3433
self.verify_supported = verify_supported
3534
self.use_verify = use_verify

libcxx/utils/libcxx/test/config.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ def configure(self):
124124
self.configure_obj_root()
125125
self.cxx_stdlib_under_test = self.get_lit_conf('cxx_stdlib_under_test', 'libc++')
126126
self.cxx_library_root = self.get_lit_conf('cxx_library_root', self.libcxx_obj_root)
127-
self.abi_library_root = self.get_lit_conf('abi_library_path', None)
127+
self.abi_library_root = self.get_lit_conf('abi_library_root', None)
128128
self.cxx_runtime_root = self.get_lit_conf('cxx_runtime_root', self.cxx_library_root)
129+
self.abi_runtime_root = self.get_lit_conf('abi_runtime_root', self.abi_library_root)
129130
self.configure_compile_flags()
130131
self.configure_link_flags()
131132
self.configure_env()
@@ -158,6 +159,8 @@ def print_config_info(self):
158159
self.lit_config.note('Adding environment variables: %r' % show_env_vars)
159160
self.lit_config.note("Linking against the C++ Library at {}".format(self.cxx_library_root))
160161
self.lit_config.note("Running against the C++ Library at {}".format(self.cxx_runtime_root))
162+
self.lit_config.note("Linking against the ABI Library at {}".format(self.abi_library_root))
163+
self.lit_config.note("Running against the ABI Library at {}".format(self.abi_runtime_root))
161164
sys.stderr.flush() # Force flushing to avoid broken output on Windows
162165

163166
def get_test_format(self):
@@ -423,10 +426,11 @@ def configure_link_flags_abi_library_path(self):
423426
# Configure ABI library paths.
424427
if self.abi_library_root:
425428
self.cxx.link_flags += ['-L' + self.abi_library_root]
429+
if self.abi_runtime_root:
426430
if not self.target_info.is_windows():
427-
self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_library_root]
431+
self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_runtime_root]
428432
else:
429-
self.add_path(self.exec_env, self.abi_library_root)
433+
self.add_path(self.exec_env, self.abi_runtime_root)
430434

431435
def configure_link_flags_cxx_library(self):
432436
if self.link_shared:
@@ -460,7 +464,6 @@ def configure_link_flags_abi_library(self):
460464
if self.abi_library_root:
461465
libname = self.make_static_lib_name('c++abi')
462466
abs_path = os.path.join(self.abi_library_root, libname)
463-
self.cxx.link_libcxxabi_flag = abs_path
464467
self.cxx.link_flags += [abs_path]
465468
else:
466469
self.cxx.link_flags += ['-lc++abi']
@@ -590,7 +593,7 @@ def configure_substitutions(self):
590593
sub.append(('%{flags}', ' '.join(map(pipes.quote, flags))))
591594
sub.append(('%{compile_flags}', ' '.join(map(pipes.quote, compile_flags))))
592595
sub.append(('%{link_flags}', ' '.join(map(pipes.quote, self.cxx.link_flags))))
593-
sub.append(('%{link_libcxxabi}', pipes.quote(self.cxx.link_libcxxabi_flag)))
596+
594597
codesign_ident = self.get_lit_conf('llvm_codesign_identity', '')
595598
env_vars = ' '.join('%s=%s' % (k, pipes.quote(v)) for (k, v) in self.exec_env.items())
596599
exec_args = [

libcxxabi/test/catch_function_01.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// XFAIL: gcc
1414
// UNSUPPORTED: no-exceptions
1515

16+
// 65ace9daa360 made it in the dylib in macOS 10.11
17+
// XFAIL: with_system_cxx_lib=macosx10.10
18+
// XFAIL: with_system_cxx_lib=macosx10.9
19+
1620
#include <cassert>
1721

1822
template <class Tp>

libcxxabi/test/catch_member_data_pointer_01.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
// UNSUPPORTED: no-exceptions
1010

11+
// 1b00fc5d8133 made it in the dylib in macOS 10.11
12+
// XFAIL: with_system_cxx_lib=macosx10.10
13+
// XFAIL: with_system_cxx_lib=macosx10.9
14+
1115
#include <cassert>
1216

1317
struct A

libcxxabi/test/catch_member_pointer_nullptr.pass.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// Catching an exception thrown as nullptr was not properly handled before
10+
// 2f984cab4fa7, which landed in macOS 10.13
11+
// XFAIL: with_system_cxx_lib=macosx10.12
12+
// XFAIL: with_system_cxx_lib=macosx10.11
13+
// XFAIL: with_system_cxx_lib=macosx10.10
14+
// XFAIL: with_system_cxx_lib=macosx10.9
15+
916
// UNSUPPORTED: no-exceptions
1017

1118
#include <cassert>

libcxxabi/test/catch_multi_level_pointer.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
// UNSUPPORTED: no-exceptions
1010

11+
// 1b00fc5d8133 made it in the dylib in macOS 10.11
12+
// XFAIL: with_system_cxx_lib=macosx10.10
13+
// XFAIL: with_system_cxx_lib=macosx10.9
14+
1115
#include <cassert>
1216
#include <cstdio>
1317
#include <cstdlib>

libcxxabi/test/catch_pointer_nullptr.pass.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// Catching an exception thrown as nullptr was not properly handled before
10+
// 2f984cab4fa7, which landed in macOS 10.13
11+
// XFAIL: with_system_cxx_lib=macosx10.12
12+
// XFAIL: with_system_cxx_lib=macosx10.11
13+
// XFAIL: with_system_cxx_lib=macosx10.10
14+
// XFAIL: with_system_cxx_lib=macosx10.9
15+
916
// UNSUPPORTED: c++03
1017
// UNSUPPORTED: no-exceptions
1118

0 commit comments

Comments
 (0)