Skip to content

Commit 718ec79

Browse files
committed
[test] Fix incorrect usage of swift_obj_root in unified builds
When doing an unified build (Swift being an external project of LLVM), the Swift build is at `<llvm build dir>/tools/swift`, and that is the value of `swift_obj_root`. However many products are actually placed in `<llvm build dir>`, like `bin/`, `include/` and things like `lib/swift/...` and others. A couple of macros tests check the error messages printed by the compiler against `swift_obj_root` (by the replacement done in `PathSanitizingFileCheck` of `BUILD_DIR`) when it should have been checking them against the top-level build directory, which will work in both unified and non-unified builds (like `build-script` builds).
1 parent 56ec625 commit 718ec79

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

test/lit.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,12 +2978,12 @@ run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitiz
29782978
shell_quote(sys.executable),
29792979
shell_quote(config.PathSanitizingFileCheck),
29802980
# LLVM Lit performs realpath with the config path, so all paths are relative
2981-
# to the real path. swift_obj_root and swift_src_root come from CMake, which
2981+
# to the real path. cmake_binary_dir and swift_src_root come from CMake, which
29822982
# might not do real path. Because we have to match what Lit uses against what
29832983
# we provide we use realpath here. Because PathSanitizingFileCheck only
29842984
# understands sanitize patterns with forward slashes, and realpath normalizes
29852985
# the slashes, we have to replace them back to forward slashes.
2986-
shell_quote(lit.util.abs_path_preserve_drive(swift_obj_root).replace("\\", "/")),
2986+
shell_quote(lit.util.abs_path_preserve_drive(cmake_binary_dir).replace("\\", "/")),
29872987
shell_quote(lit.util.abs_path_preserve_drive(config.swift_src_root).replace("\\", "/")),
29882988
shell_quote(config.filecheck),
29892989
'--color' if config.color_output else '',

test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import sys
1616
import lit.util
1717

1818
config.cmake = "@CMAKE_COMMAND@"
19+
config.cmake_binary_dir = "@CMAKE_BINARY_DIR@"
1920
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
2021
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
2122
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

validation-test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import sys
1414
import platform
1515

1616
config.cmake = "@CMAKE_COMMAND@"
17+
config.cmake_binary_dir = "@CMAKE_BINARY_DIR@"
1718
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
1819
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
1920
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

0 commit comments

Comments
 (0)