Skip to content

Commit 2d77de9

Browse files
committed
Build and run tests against toolchain instead of llvm-build-dir
Install everything we need to run tests (CMake modules, FileCheck, etc.) into the toolchain directory. Add synthetic target 'all' for llvm-install-components. Also we must set LLVM_INSTALL_UTILS=ON, so the utilities required by tests (e.g., FileCheck) are included in the install target.
1 parent e54fe2c commit 2d77de9

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

utils/build-presets.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,11 +1029,13 @@ llvm-include-tests
10291029
mixin-preset=buildbot_incremental_linux,llvm-only
10301030
build-subdir=buildbot_incremental_tsan_libdispatch_test
10311031

1032+
llvm-cmake-options=-DLLVM_INSTALL_UTILS=ON
1033+
llvm-install-components=all
1034+
10321035
libdispatch-cmake-options=-DENABLE_SWIFT=OFF
10331036
libdispatch
10341037
install-libdispatch
10351038

1036-
lit-args=-v --timeout=10
10371039
tsan-libdispatch-test
10381040

10391041

utils/build-script-impl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3475,7 +3475,11 @@ for host in "${ALL_HOSTS[@]}"; do
34753475
if [[ -z "${LLVM_INSTALL_COMPONENTS}" ]] ; then
34763476
continue
34773477
fi
3478-
INSTALL_TARGETS=install-$(echo ${LLVM_INSTALL_COMPONENTS} | sed -E 's/;/ install-/g')
3478+
if [[ "${LLVM_INSTALL_COMPONENTS}" == "all" ]]; then
3479+
INSTALL_TARGETS=install
3480+
else
3481+
INSTALL_TARGETS=install-$(echo ${LLVM_INSTALL_COMPONENTS} | sed -E 's/;/ install-/g')
3482+
fi
34793483
;;
34803484
libcxx)
34813485
if [[ -z "${INSTALL_LIBCXX}" ]] ; then

utils/swift_build_support/swift_build_support/products/tsan_libdispatch.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
from .. import shell
1717

1818

19-
def join_path(p1, p2):
20-
return os.path.abspath(os.path.join(p1, p2))
19+
def join_path(*paths):
20+
return os.path.abspath(os.path.join(*paths))
2121

2222
class TSanLibDispatch(product.Product):
2323
@classmethod
@@ -30,21 +30,21 @@ def is_build_script_impl_product(cls):
3030

3131
def build(self, host_target):
3232
"""Build TSan runtime (compiler-rt)."""
33-
rt_source_dir = join_path(self.source_dir, '../compiler-rt')
34-
llvm_build_dir = join_path(self.build_dir, '../llvm-' + host_target)
35-
libdispatch_path = join_path(self.args.install_destdir, 'usr')
33+
rt_source_dir = join_path(self.source_dir, os.pardir, 'compiler-rt')
34+
toolchain_path = join_path(self.args.install_destdir, 'usr')
3635

3736
config_cmd = [
3837
'cmake',
3938
'-GNinja',
40-
'-DCMAKE_PREFIX_PATH=%s' % llvm_build_dir,
39+
'-DCMAKE_PREFIX_PATH=%s' % toolchain_path,
4140
'-DCMAKE_C_COMPILER=clang',
4241
'-DCMAKE_CXX_COMPILER=clang++',
4342
'-DCMAKE_BUILD_TYPE=Release',
4443
'-DLLVM_ENABLE_ASSERTIONS=ON',
4544
'-DCOMPILER_RT_INCLUDE_TESTS=ON',
45+
'-DCOMPILER_RT_BUILD_XRAY=OFF',
4646
'-DCOMPILER_RT_INTERCEPT_LIBDISPATCH=ON',
47-
'-DCOMPILER_RT_LIBDISPATCH_INSTALL_PATH=%s' % libdispatch_path,
47+
'-DCOMPILER_RT_LIBDISPATCH_INSTALL_PATH=%s' % toolchain_path,
4848
rt_source_dir]
4949
build_cmd = ['ninja', 'tsan']
5050

0 commit comments

Comments
 (0)