[libcxx-commits] [libcxx] 78669c4 - [libc++][tests] Use CMake provided paths for includes and libdir instead of hardcoding them
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 16 09:35:17 PDT 2022
Author: Louis Dionne
Date: 2022-03-16T12:35:06-04:00
New Revision: 78669c4185e4f8784308b5e740721cd374052cae
URL: https://github.com/llvm/llvm-project/commit/78669c4185e4f8784308b5e740721cd374052cae
DIFF: https://github.com/llvm/llvm-project/commit/78669c4185e4f8784308b5e740721cd374052cae.diff
LOG: [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
Added:
Modified:
libcxx/test/configs/apple-libc++-backdeployment.cfg.in
libcxx/test/configs/apple-libc++-shared.cfg.in
libcxx/test/configs/cmake-bridge.cfg.in
libcxx/test/configs/ibm-libc++-shared.cfg.in
libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp
libcxx/utils/ci/run-buildbot
libcxx/utils/libcxx/test/config.py
libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in
libcxxabi/test/configs/apple-libc++abi-shared.cfg.in
libcxxabi/test/configs/cmake-bridge.cfg.in
libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
libcxxabi/test/vendor/apple/system-install-properties.sh.cpp
Removed:
################################################################################
diff --git a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
index b78a64f056607..6c2e70fbb6c1d 100644
--- a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
+++ b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
@@ -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}" -- '
diff --git a/libcxx/test/configs/apple-libc++-shared.cfg.in b/libcxx/test/configs/apple-libc++-shared.cfg.in
index e0bf921ce471e..71c4a9e50f612 100644
--- a/libcxx/test/configs/apple-libc++-shared.cfg.in
+++ b/libcxx/test/configs/apple-libc++-shared.cfg.in
@@ -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
diff --git a/libcxx/test/configs/cmake-bridge.cfg.in b/libcxx/test/configs/cmake-bridge.cfg.in
index e4796a5977a80..05ac7e594aea2 100644
--- a/libcxx/test/configs/cmake-bridge.cfg.in
+++ b/libcxx/test/configs/cmake-bridge.cfg.in
@@ -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@'))
diff --git a/libcxx/test/configs/ibm-libc++-shared.cfg.in b/libcxx/test/configs/ibm-libc++-shared.cfg.in
index 24bb8d559d15a..d8e91c834b5d0 100644
--- a/libcxx/test/configs/ibm-libc++-shared.cfg.in
+++ b/libcxx/test/configs/ibm-libc++-shared.cfg.in
@@ -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
diff --git a/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp b/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp
index ff14dda2f0b21..aaa9ad7a7d0e3 100644
--- a/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp
+++ b/libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp
@@ -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"
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index aa03765f8121f..897a10df5cc19 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -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
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index f0a40329f1469..4042e15d0f250 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -455,7 +455,6 @@ def configure_substitutions(self):
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())
diff --git a/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in b/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in
index 06dd50310729d..5839b82486fa5 100644
--- a/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in
+++ b/libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in
@@ -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}" -- '
diff --git a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in b/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in
index cf65ce44cd955..17428b9a55d63 100644
--- a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in
+++ b/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in
@@ -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
diff --git a/libcxxabi/test/configs/cmake-bridge.cfg.in b/libcxxabi/test/configs/cmake-bridge.cfg.in
index f7ede5f16acf9..eb3caf02da41d 100644
--- a/libcxxabi/test/configs/cmake-bridge.cfg.in
+++ b/libcxxabi/test/configs/cmake-bridge.cfg.in
@@ -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@'))
diff --git a/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in b/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
index 64fc4f234b843..439d250a618ea 100644
--- a/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
+++ b/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
@@ -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
diff --git a/libcxxabi/test/vendor/apple/system-install-properties.sh.cpp b/libcxxabi/test/vendor/apple/system-install-properties.sh.cpp
index 791fc67d33a86..d4df7b3dff692 100644
--- a/libcxxabi/test/vendor/apple/system-install-properties.sh.cpp
+++ b/libcxxabi/test/vendor/apple/system-install-properties.sh.cpp
@@ -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"
More information about the libcxx-commits
mailing list