mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
[libc++][tests] Use CMake provided paths for includes and libdir instead of hardcoding them
In the new-style testing configurations, we were hardcoding paths to the `include` and `lib` directories, which was incorrect but always went unnoticed because the hardcoded values always happened to match the actual value. When using new-style configs with the bootstrapping build, this falls appart -- and we never noticed this because the bootstrapping build was still using old style configs. This patch removes the %{install} substitution, which makes it too tempting to hardcode installation paths, and it also switches the bootstrapping build to actually using new-style configs like we always intended to do. Differential Revision: https://reviews.llvm.org/D121700
This commit is contained in:
parent
a36d269658
commit
78669c4185
@ -45,10 +45,10 @@ 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 -I %{libcxx}/test/support'
|
||||
'-nostdinc++ -I %{include} -I %{libcxx}/test/support'
|
||||
))
|
||||
config.substitutions.append(('%{link_flags}',
|
||||
'-nostdlib++ -L %{install}/lib -lc++'
|
||||
'-nostdlib++ -L %{lib} -lc++'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}:%{unwind-runtime-root}" -- '
|
||||
|
@ -13,13 +13,13 @@ config.substitutions.append(('%{flags}',
|
||||
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
|
||||
))
|
||||
config.substitutions.append(('%{compile_flags}',
|
||||
'-nostdinc++ -I %{install}/include/c++/v1 -I %{libcxx}/test/support'
|
||||
'-nostdinc++ -I %{include} -I %{libcxx}/test/support'
|
||||
))
|
||||
config.substitutions.append(('%{link_flags}',
|
||||
'-nostdlib++ -L %{install}/lib -lc++'
|
||||
'-nostdlib++ -L %{lib} -lc++'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{install}/lib -- '
|
||||
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib} -- '
|
||||
))
|
||||
|
||||
import os, site
|
||||
|
@ -27,8 +27,7 @@ config.test_exec_root = os.path.join('@CMAKE_BINARY_DIR@', 'test')
|
||||
# Add substitutions for bootstrapping the test suite configuration
|
||||
config.substitutions.append(('%{cxx}', shlex.quote('@CMAKE_CXX_COMPILER@')))
|
||||
config.substitutions.append(('%{libcxx}', '@LIBCXX_SOURCE_DIR@'))
|
||||
config.substitutions.append(('%{install}', '@CMAKE_BINARY_DIR@'))
|
||||
config.substitutions.append(('%{include}', '%{install}/@LIBCXX_INSTALL_INCLUDE_DIR@'))
|
||||
config.substitutions.append(('%{target-include}', '%{install}/@LIBCXX_INSTALL_INCLUDE_TARGET_DIR@'))
|
||||
config.substitutions.append(('%{lib}', '%{install}/@LIBCXX_INSTALL_LIBRARY_DIR@'))
|
||||
config.substitutions.append(('%{include}', '@LIBCXX_GENERATED_INCLUDE_DIR@'))
|
||||
config.substitutions.append(('%{target-include}', '@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@'))
|
||||
config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@'))
|
||||
config.substitutions.append(('%{executor}', '@LIBCXX_EXECUTOR@'))
|
||||
|
@ -6,13 +6,13 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
|
||||
|
||||
config.substitutions.append(('%{flags}', ''))
|
||||
config.substitutions.append(('%{compile_flags}',
|
||||
'-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -I %{install}/include/c++/v1 -I %{libcxx}/test/support'
|
||||
'-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -I %{include} -I %{libcxx}/test/support'
|
||||
))
|
||||
config.substitutions.append(('%{link_flags}',
|
||||
'-nostdlib++ -L %{install}/lib -lc++ -lc++abi -latomic -Wl,-bbigtoc'
|
||||
'-nostdlib++ -L %{lib} -lc++ -lc++abi -latomic -Wl,-bbigtoc'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %T --env LIBPATH=%{install}/lib -- '
|
||||
'%{executor} --execdir %T --env LIBPATH=%{lib} -- '
|
||||
))
|
||||
|
||||
# LIBCXX-AIX-FIXME is the feature name used to XFAIL the
|
||||
|
@ -10,21 +10,19 @@
|
||||
|
||||
// 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"
|
||||
// RUN: stat "%{include}/__config"
|
||||
|
||||
// Make sure we install libc++.1.dylib in the right location.
|
||||
//
|
||||
// RUN: stat "%{install}/lib/libc++.1.dylib"
|
||||
// RUN: stat "%{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"
|
||||
// RUN: stat "%{lib}/libc++.dylib"
|
||||
// RUN: readlink "%{lib}/libc++.dylib" | grep "libc++.1.dylib"
|
||||
|
||||
// Make sure the install_name is /usr/lib.
|
||||
//
|
||||
@ -35,11 +33,11 @@
|
||||
//
|
||||
// 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"
|
||||
// XRUNX: otool -L "%{lib}/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib'
|
||||
// XRUNX: ! otool -l "%{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"
|
||||
// RUN: otool -L "%{lib}/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0"
|
||||
|
@ -497,8 +497,8 @@ bootstrapping-build)
|
||||
-DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
|
||||
-DLLVM_ENABLE_ASSERTIONS=ON \
|
||||
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" \
|
||||
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
|
||||
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
|
||||
-DRUNTIMES_LIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
|
||||
-DRUNTIMES_LIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
|
||||
|
||||
echo "+++ Running the libc++ and libc++abi tests"
|
||||
${NINJA} -C "${BUILD_DIR}" check-runtimes
|
||||
|
@ -455,7 +455,6 @@ class Configuration(object):
|
||||
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())
|
||||
|
@ -45,11 +45,11 @@ config.substitutions.append(('%{flags}',
|
||||
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
|
||||
))
|
||||
config.substitutions.append(('%{compile_flags}',
|
||||
'-nostdinc++ -I %{install}/include/c++/v1 -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
|
||||
'-nostdinc++ -I %{include} -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'
|
||||
'-nostdlib++ -L %{lib} -lc++ -lc++abi'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}:%{unwind-runtime-root}" -- '
|
||||
|
@ -6,14 +6,14 @@ config.substitutions.append(('%{flags}',
|
||||
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
|
||||
))
|
||||
config.substitutions.append(('%{compile_flags}',
|
||||
'-nostdinc++ -I %{install}/include/c++/v1 -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
|
||||
'-nostdinc++ -I %{include} -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'
|
||||
'-nostdlib++ -L %{lib} -lc++ -lc++abi'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{install}/lib -- '
|
||||
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib} -- '
|
||||
))
|
||||
|
||||
import os, site
|
||||
|
@ -28,5 +28,7 @@ config.host_triple = '@LLVM_HOST_TRIPLE@'
|
||||
|
||||
config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@'))
|
||||
config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@'))
|
||||
config.substitutions.append(('%{install}', '@CMAKE_BINARY_DIR@'))
|
||||
config.substitutions.append(('%{include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1'))
|
||||
config.substitutions.append(('%{target-include}', '@LIBCXXABI_HEADER_DIR@/%{triple}/include/c++/v1'))
|
||||
config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@'))
|
||||
config.substitutions.append(('%{executor}', '@LIBCXXABI_EXECUTOR@'))
|
||||
|
@ -4,16 +4,16 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
|
||||
|
||||
config.substitutions.append(('%{flags}',''))
|
||||
config.substitutions.append(('%{compile_flags}',
|
||||
'-nostdinc++ -I %{install}/include/c++/v1 ' +
|
||||
'-nostdinc++ -I %{include} ' +
|
||||
'-D__LIBC_NO_CPP_MATH_OVERLOADS__ -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 -Wl,-bbigtoc'
|
||||
'-nostdlib++ -L %{lib} -lc++ -lc++abi -Wl,-bbigtoc'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %T --env LIBPATH=%{install}/lib -- '
|
||||
'%{executor} --execdir %T --env LIBPATH=%{lib} -- '
|
||||
))
|
||||
|
||||
import os, site
|
||||
|
@ -10,24 +10,22 @@
|
||||
|
||||
// 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"
|
||||
// XRUNX: stat "%{include}/cxxabi.h"
|
||||
|
||||
// Make sure we install libc++abi.dylib in the right location.
|
||||
//
|
||||
// RUN: stat "%{install}/lib/libc++abi.dylib"
|
||||
// RUN: stat "%{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"
|
||||
// XRUNX: ! readlink "%{lib}/libc++abi.dylib"
|
||||
// XRUNX: ! stat "%{lib}/libc++abi.1.dylib"
|
||||
|
||||
// Make sure the install_name is /usr/lib.
|
||||
//
|
||||
@ -38,11 +36,11 @@
|
||||
//
|
||||
// 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"
|
||||
// XRUNX: otool -L "%{lib}/libc++abi.dylib" | grep '/usr/lib/libc++abi.dylib'
|
||||
// XRUNX: ! otool -l "%{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"
|
||||
// RUN: otool -L "%{lib}/libc++abi.dylib" | grep "libc++abi.1.dylib" | grep "compatibility version 1.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user