set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "")
+
+set(LIBCXX_TEST_PARAMS "stdlib=apple-libc++" CACHE STRING "")
+set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
config.cxx_headers = "@LIBCXX_GENERATED_INCLUDE_DIR@"
config.cxx_under_test = "@CMAKE_CXX_COMPILER@"
config.project_obj_root = "@CMAKE_BINARY_DIR@"
+config.install_root = "@CMAKE_BINARY_DIR@"
config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
pipes.quote(sys.executable),
pipes.quote(runPy))
))
+config.substitutions.append(('%{install}', INSTALL_ROOT))
# Add parameters and features to the config
libcxx.test.newconfig.configure(
pipes.quote(sys.executable),
pipes.quote(runPy))
))
+config.substitutions.append(('%{install}', INSTALL_ROOT))
# Add parameters and features to the config
libcxx.test.newconfig.configure(
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++ when built as
+// a system library on Apple platforms.
+//
+// TODO: We should install to `<prefix>/usr` in CMake and check that path instead.
+
+// Make sure we install the libc++ headers in the right location.
+//
+// RUN: stat "%{install}/include/c++/v1/__config"
+
+// Make sure we install libc++.1.dylib in the right location.
+//
+// RUN: stat "%{install}/lib/libc++.1.dylib"
+
+// Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
+//
+// RUN: stat "%{install}/lib/libc++.dylib"
+// RUN: readlink "%{install}/lib/libc++.dylib" | grep "libc++.1.dylib"
+
+// Make sure the install_name is /usr/lib.
+//
+// In particular, make sure we don't use any @rpath in the load commands. When building as
+// a system library, it is important to hardcode the installation paths in the dylib, because
+// various tools like dyld and ld64 will treat us specially if they recognize us as being a
+// system library.
+//
+// TODO: We currently don't do that correctly in the CMake build.
+//
+// XRUNX: otool -L "%{install}/lib/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib'
+// XRUNX: ! otool -l "%{install}/lib/libc++.1.dylib" | grep -E "LC_RPATH|@loader_path|@rpath"
+
+// Make sure the compatibility_version of libc++ is 1.0.0.
+// Failure to respect this can result in applications not being able to find libc++
+// when they are loaded by dyld, if the compatibility version was bumped.
+//
+// RUN: otool -L "%{install}/lib/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0"
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// Skip this test on windows. If built on top of the MSVC runtime, the
// <cuchar> header actually does exist (although not provided by us).
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
-// UNSUPPORTED: !stdlib=libc++ && c++11
-// UNSUPPORTED: !stdlib=libc++ && c++14
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++11
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++14
// <charconv>
// In
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
-// UNSUPPORTED: !stdlib=libc++ && c++11
-// UNSUPPORTED: !stdlib=libc++ && c++14
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++11
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++14
// <charconv>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
-// UNSUPPORTED: !stdlib=libc++ && c++11
-// UNSUPPORTED: !stdlib=libc++ && c++14
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++11
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++14
// The roundtrip test uses to_chars, which requires functions in the dylib
// that were introduced in Mac OS 10.15.
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
-// UNSUPPORTED: !stdlib=libc++ && c++11
-// UNSUPPORTED: !stdlib=libc++ && c++14
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++11
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++14
// <charconv>
// In
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
-// UNSUPPORTED: !stdlib=libc++ && c++11
-// UNSUPPORTED: !stdlib=libc++ && c++14
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++11
+// UNSUPPORTED: !stdlib={{.+}}-libc++ && c++14
// to_chars requires functions in the dylib that were introduced in Mac OS 10.15.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14
-// XFAIL: stdlib=libc++
+// XFAIL: stdlib={{.+}}-libc++
// <functional>
sub.append(('%{flags}', ' '.join(map(self.quote, flags))))
sub.append(('%{compile_flags}', ' '.join(map(self.quote, compile_flags))))
sub.append(('%{link_flags}', ' '.join(map(self.quote, self.cxx.link_flags))))
+ sub.append(('%{install}', self.quote(self.config.install_root)))
codesign_ident = self.get_lit_conf('llvm_codesign_identity', '')
env_vars = ' '.join('%s=%s' % (k, self.quote(v)) for (k, v) in self.exec_env.items())
AddCompileFlag('-fno-rtti')
]),
- Parameter(name='stdlib', choices=['libc++', 'libstdc++', 'msvc'], type=str, default='libc++',
- help="The C++ Standard Library implementation being tested.",
+ Parameter(name='stdlib', choices=['llvm-libc++', 'apple-libc++', 'libstdc++', 'msvc'], type=str, default='llvm-libc++',
+ help="""The C++ Standard Library implementation being tested.
+
+ Note that this parameter can also be used to encode different 'flavors' of the same
+ standard library, such as libc++ as shipped by a different vendor, if it has different
+ properties worth testing.
+
+ The Standard libraries currently supported are:
+ - llvm-libc++: The 'upstream' libc++ as shipped with LLVM.
+ - apple-libc++: libc++ as shipped by Apple. This is basically like the LLVM one, but
+ there are a few differences like installation paths and the use of
+ universal dylibs.
+ - libstdc++: The GNU C++ library typically shipped with GCC.
+ - msvc: The Microsoft implementation of the C++ Standard Library.
+ """,
actions=lambda stdlib: [
AddFeature('stdlib={}'.format(stdlib))
]),
config.cxx_under_test = "@CMAKE_CXX_COMPILER@"
config.project_obj_root = "@CMAKE_BINARY_DIR@"
+config.install_root = "@CMAKE_BINARY_DIR@"
config.libcxxabi_hdr_root = "@LIBCXXABI_HEADER_DIR@"
config.libcxxabi_src_root = "@LIBCXXABI_SOURCE_DIR@"
config.libcxxabi_obj_root = "@LIBCXXABI_BINARY_DIR@"
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++abi when built
+// as a system library on Apple platforms.
+//
+// TODO: We should install to `<prefix>/usr` in CMake and check that path instead.
+
+// Make sure we install the libc++abi headers in the right location.
+// TODO: We don't currently install them, but we should.
+//
+// XRUNX: stat "%{install}/include/cxxabi.h"
+
+// Make sure we install libc++abi.dylib in the right location.
+//
+// RUN: stat "%{install}/lib/libc++abi.dylib"
+
+// Make sure we don't install a symlink from libc++abi.dylib to libc++abi.1.dylib,
+// unlike what we do for libc++.dylib.
+// TODO: We currently don't do that correctly in the CMake build.
+//
+// XRUNX: ! readlink "%{install}/lib/libc++abi.dylib"
+// XRUNX: ! stat "%{install}/lib/libc++abi.1.dylib"
+
+// Make sure the install_name is /usr/lib.
+//
+// In particular, make sure we don't use any @rpath in the load commands. When building as
+// a system library, it is important to hardcode the installation paths in the dylib, because
+// various tools like dyld and ld64 will treat us specially if they recognize us as being a
+// system library.
+//
+// TODO: We currently don't do that correctly in the CMake build.
+//
+// XRUNX: otool -L "%{install}/lib/libc++abi.dylib" | grep '/usr/lib/libc++abi.dylib'
+// XRUNX: ! otool -l "%{install}/lib/libc++abi.dylib" | grep -E "LC_RPATH|@loader_path|@rpath"
+
+// Make sure the compatibility_version of libc++abi is 1.0.0. Failure to respect this can result
+// in applications not being able to find libc++abi when they are loaded by dyld, if the
+// compatibility version was bumped.
+//
+// RUN: otool -L "%{install}/lib/libc++abi.dylib" | grep "libc++abi.1.dylib" | grep "compatibility version 1.0.0"