Skip to content

[compiler-rt] Allow running tests without installing first #83088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,27 @@ string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " ${stdlib_flag}")
string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS})

option(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
"When set to ON and testing in a standalone build, test the runtime \
libraries built by this standalone build rather than the runtime libraries \
shipped with the compiler (used for testing). When set to OFF and testing \
in a standalone build, test the runtime libraries shipped with the compiler \
(used for testing). This option has no effect if the compiler and this \
build are configured to use the same runtime library path."
ON)
if (COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)
# Ensure that the unit tests can find the sanitizer headers prior to installation.
list(APPEND COMPILER_RT_UNITTEST_CFLAGS "-I${CMAKE_CURRENT_LIST_DIR}/include")
# Ensure that unit tests link against the just-built runtime libraries instead
# of the ones bundled with the compiler by overriding the resource directory.
#
if ("${COMPILER_RT_TEST_COMPILER_ID}" MATCHES "Clang")
list(APPEND COMPILER_RT_UNITTEST_LINK_FLAGS "-resource-dir=${CMAKE_CURRENT_BINARY_DIR}")
endif()
get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir)
list(APPEND COMPILER_RT_UNITTEST_LINK_FLAGS "-Wl,-rpath,${output_dir}")
endif()

if(COMPILER_RT_USE_LLVM_UNWINDER)
# We're linking directly against the libunwind that we're building so don't
# try to link in the toolchain's default libunwind which may be missing.
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/cmake/Modules/AddCompilerRT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ function(configure_compiler_rt_lit_site_cfg input output)
get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir)

string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} COMPILER_RT_RESOLVED_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER})
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} COMPILER_RT_RESOLVED_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR})
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR ${output_dir})

configure_lit_site_cfg(${input} ${output})
Expand Down
5 changes: 3 additions & 2 deletions compiler-rt/cmake/Modules/CompilerRTCompile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function(sanitizer_test_compile obj_list source arch)
# Write out architecture-specific flags into TARGET_CFLAGS variable.
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
set(COMPILE_DEPS ${TEST_COMPILE_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
if(NOT COMPILER_RT_STANDALONE_BUILD OR COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)
list(APPEND COMPILE_DEPS ${TEST_DEPS})
endif()
clang_compile(${output_obj} ${source}
Expand All @@ -65,8 +65,9 @@ function(clang_compile object_file source)
cmake_parse_arguments(SOURCE "" "" "CFLAGS;DEPS" ${ARGN})
get_filename_component(source_rpath ${source} REALPATH)
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SOURCE_DEPS clang compiler-rt-headers)
list(APPEND SOURCE_DEPS clang)
endif()
list(APPEND SOURCE_DEPS compiler-rt-headers)
if (TARGET CompilerRTUnitTestCheckCxx)
list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
endif()
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function(add_asan_tests arch test_runtime)
function(generate_asan_tests test_objects test_suite testname)
generate_compiler_rt_tests(${test_objects} ${test_suite} ${testname} ${arch}
COMPILE_DEPS ${ASAN_UNITTEST_HEADERS} ${ASAN_IGNORELIST_FILE}
DEPS llvm_gtest asan
DEPS asan
KIND ${TEST_KIND}
${ARGN}
)
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/fuzzer/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH)
FuzzerUnitTests "Fuzzer-${arch}-Test" ${arch}
SOURCES FuzzerUnittest.cpp ${COMPILER_RT_GTEST_SOURCE}
RUNTIME ${LIBFUZZER_TEST_RUNTIME}
DEPS llvm_gtest ${LIBFUZZER_TEST_RUNTIME_DEPS}
DEPS ${LIBFUZZER_TEST_RUNTIME_DEPS}
CFLAGS ${LIBFUZZER_UNITTEST_CFLAGS} ${LIBFUZZER_TEST_RUNTIME_CFLAGS}
LINK_FLAGS ${LIBFUZZER_UNITTEST_LINK_FLAGS} ${LIBFUZZER_TEST_RUNTIME_LINK_FLAGS})
set_target_properties(FuzzerUnitTests PROPERTIES
Expand All @@ -84,7 +84,7 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH)
generate_compiler_rt_tests(FuzzedDataProviderTestObjects
FuzzedDataProviderUnitTests "FuzzerUtils-${arch}-Test" ${arch}
SOURCES FuzzedDataProviderUnittest.cpp ${COMPILER_RT_GTEST_SOURCE}
DEPS llvm_gtest ${LIBFUZZER_TEST_RUNTIME_DEPS} ${COMPILER_RT_SOURCE_DIR}/include/fuzzer/FuzzedDataProvider.h
DEPS ${LIBFUZZER_TEST_RUNTIME_DEPS} ${COMPILER_RT_SOURCE_DIR}/include/fuzzer/FuzzedDataProvider.h
CFLAGS ${LIBFUZZER_UNITTEST_CFLAGS} ${LIBFUZZER_TEST_RUNTIME_CFLAGS}
LINK_FLAGS ${LIBFUZZER_UNITTEST_LINK_FLAGS} ${LIBFUZZER_TEST_RUNTIME_LINK_FLAGS})
set_target_properties(FuzzedDataProviderUnitTests PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST GWP_ASAN_SUPPORTED_ARCH)
GwpAsanUnitTests "GwpAsan-${arch}-Test" ${arch}
SOURCES ${GWP_ASAN_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
RUNTIME ${GWP_ASAN_TEST_RUNTIME}
DEPS llvm_gtest ${GWP_ASAN_UNIT_TEST_HEADERS}
DEPS ${GWP_ASAN_UNIT_TEST_HEADERS}
CFLAGS ${GWP_ASAN_UNITTEST_CFLAGS}
LINK_FLAGS ${GWP_ASAN_UNITTEST_LINK_FLAGS})
set_target_properties(GwpAsanUnitTests PROPERTIES
Expand Down
1 change: 0 additions & 1 deletion compiler-rt/lib/interception/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ macro(add_interception_tests_for_arch arch)
RUNTIME ${INTERCEPTION_COMMON_LIB}
SOURCES ${INTERCEPTION_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
COMPILE_DEPS ${INTERCEPTION_TEST_HEADERS}
DEPS llvm_gtest
CFLAGS ${INTERCEPTION_TEST_CFLAGS_COMMON}
LINK_FLAGS ${INTERCEPTION_TEST_LINK_FLAGS_COMMON})
endmacro()
Expand Down
9 changes: 4 additions & 5 deletions compiler-rt/lib/msan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ set(MSAN_LIBCXX_CFLAGS
-fsanitize-memory-track-origins
-fno-sanitize-memory-param-retval # unittests test mostly this mode.
-Wno-pedantic
-Xclang -fdepfile-entry=${COMPILER_RT_OUTPUT_DIR}/share/msan_ignorelist.txt
# Do not instrument __gxx_personality_v0 (part of libcxxabi)
-fsanitize-ignorelist=${COMPILER_RT_OUTPUT_DIR}/share/msan_ignorelist.txt
)

# Unittest sources and build flags.
Expand Down Expand Up @@ -69,7 +70,7 @@ macro(msan_compile obj_list source arch kind cflags)
${obj_list} ${source} ${arch}
KIND ${kind}
COMPILE_DEPS ${MSAN_UNITTEST_HEADERS}
DEPS llvm_gtest msan
DEPS msan
CFLAGS -isystem ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}/include/c++/v1
${MSAN_UNITTEST_INSTRUMENTED_CFLAGS} ${cflags}
)
Expand Down Expand Up @@ -119,9 +120,7 @@ macro(add_msan_tests_for_arch arch kind cflags)
set(MSAN_TEST_DEPS ${MSAN_TEST_OBJECTS} libcxx_msan_${arch}-build
${MSAN_LOADABLE_SO}
"${MSAN_LIBCXX_DIR}/libc++.a" "${MSAN_LIBCXX_DIR}/libc++abi.a")
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND MSAN_TEST_DEPS msan)
endif()
list(APPEND MSAN_TEST_DEPS msan)
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
add_compiler_rt_test(MsanUnitTests "Msan-${arch}${kind}-Test" ${arch}
OBJECTS ${MSAN_TEST_OBJECTS} "${MSAN_LIBCXX_DIR}/libc++.a" "${MSAN_LIBCXX_DIR}/libc++abi.a"
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/orc/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ macro(add_orc_unittest testname)
SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
RUNTIME "${ORC_RUNTIME_LIBS}"
COMPILE_DEPS ${TEST_HEADERS} ${ORC_HEADERS}
DEPS llvm_gtest ${ORC_DEPS}
DEPS ${ORC_DEPS}
CFLAGS ${ORC_UNITTEST_CFLAGS} ${COMPILER_RT_GTEST_CFLAGS}
LINK_FLAGS ${ORC_UNITTEST_LINK_FLAGS})
endif()
Expand Down
1 change: 0 additions & 1 deletion compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ macro(add_sanitizer_tests_for_arch arch)
RUNTIME "${SANITIZER_COMMON_LIB}"
SOURCES ${SANITIZER_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE} ${COMPILER_RT_GMOCK_SOURCE}
COMPILE_DEPS ${SANITIZER_TEST_HEADERS}
DEPS llvm_gtest
CFLAGS ${SANITIZER_TEST_CFLAGS_COMMON} ${extra_flags}
LINK_FLAGS ${SANITIZER_TEST_LINK_FLAGS_COMMON} ${TARGET_LINK_FLAGS} ${extra_flags})

Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ macro(add_scudo_unittest testname)
"${testname}-${arch}-Test" ${arch}
SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
COMPILE_DEPS ${SCUDO_TEST_HEADERS}
DEPS llvm_gtest scudo_standalone
DEPS scudo_standalone
RUNTIME ${RUNTIME}
CFLAGS ${SCUDO_UNITTEST_CFLAGS}
LINK_FLAGS ${SCUDO_UNITTEST_LINK_FLAGS})
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/tsan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ foreach (header ${TSAN_HEADERS})
list(APPEND TSAN_RTL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../${header})
endforeach()

set(TSAN_DEPS llvm_gtest tsan)
set(TSAN_DEPS tsan)
# TSan uses C++ standard library headers.
if (TARGET cxx-headers OR HAVE_LIBCXX)
set(TSAN_DEPS cxx-headers)
list(APPEND TSAN_DEPS cxx-headers)
endif()

# add_tsan_unittest(<name>
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/xray/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ macro(add_xray_unittest testname)
${XRAY_HEADERS} ${XRAY_ALL_SOURCE_FILES_ABS_PATHS}
"test_helpers.h"
RUNTIME "${XRAY_RUNTIME_LIBS}"
DEPS llvm_gtest xray llvm-xray LLVMXRay LLVMTestingSupport
DEPS xray llvm-xray LLVMXRay LLVMTestingSupport
CFLAGS ${XRAY_UNITTEST_CFLAGS}
LINK_FLAGS ${TARGET_LINK_FLAGS} ${XRAY_UNITTEST_LINK_FLAGS}
)
Expand Down
8 changes: 0 additions & 8 deletions compiler-rt/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Needed for lit support in standalone builds.
include(AddLLVM)

option(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
"When set to ON and testing in a standalone build, test the runtime \
libraries built by this standalone build rather than the runtime libraries \
shipped with the compiler (used for testing). When set to OFF and testing \
in a standalone build, test the runtime libraries shipped with the compiler \
(used for testing). This option has no effect if the compiler and this \
build are configured to use the same runtime library path."
ON)
pythonize_bool(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)

pythonize_bool(LLVM_ENABLE_EXPENSIVE_CHECKS)
Expand Down
5 changes: 1 addition & 4 deletions compiler-rt/test/asan_abi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ macro(get_bits_for_arch arch bits)
endif()
endmacro()

set(ASAN_ABI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND ASAN_ABI_TEST_DEPS asan_abi)
endif()
set(ASAN_ABI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} asan_abi)

set(ASAN_ABI_TEST_ARCH ${ASAN_ABI_SUPPORTED_ARCH})
if(APPLE)
Expand Down
21 changes: 13 additions & 8 deletions compiler-rt/test/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
set(LIBFUZZER_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
set(LIBFUZZER_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} fuzzer)
if (COMPILER_RT_HAS_UBSAN)
list(APPEND LIBFUZZER_TEST_DEPS ubsan)
endif()
if (COMPILER_RT_HAS_ASAN)
list(APPEND LIBFUZZER_TEST_DEPS asan)
endif()
if (COMPILER_RT_HAS_MSAN)
list(APPEND LIBFUZZER_TEST_DEPS msan)
endif()
if (COMPILER_RT_HAS_DFSAN)
list(APPEND LIBFUZZER_TEST_DEPS dfsan)
endif()
if (NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND LIBFUZZER_TEST_DEPS fuzzer asan ubsan)
if (COMPILER_RT_HAS_MSAN)
list(APPEND LIBFUZZER_TEST_DEPS msan)
endif()
if (COMPILER_RT_HAS_DFSAN)
list(APPEND LIBFUZZER_TEST_DEPS dfsan)
endif()
if(NOT APPLE AND COMPILER_RT_HAS_LLD AND "lld" IN_LIST LLVM_ENABLE_PROJECTS)
list(APPEND LIBFUZZER_TEST_DEPS lld)
endif()
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/test/fuzzer/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
return " ".join(
[
compiler_cmd,
config.target_cflags,
std_cmd,
"-O2 -gline-tables-only",
sanitizers_cmd,
Expand Down
80 changes: 58 additions & 22 deletions compiler-rt/test/lit.common.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@
import lit.util


def get_path_from_clang(args, allow_failure):
clang_cmd = [
config.clang.strip(),
f"--target={config.target_triple}",
*args,
]
path = None
try:
result = subprocess.run(
clang_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True
)
path = result.stdout.decode().strip()
except subprocess.CalledProcessError as e:
msg = f"Failed to run {clang_cmd}\nrc:{e.returncode}\nstdout:{e.stdout}\ne.stderr{e.stderr}"
if allow_failure:
lit_config.warning(msg)
else:
lit_config.fatal(msg)
return path, clang_cmd


def find_compiler_libdir():
"""
Returns the path to library resource directory used
Expand All @@ -26,26 +47,6 @@ def find_compiler_libdir():
# TODO: Support other compilers.
return None

def get_path_from_clang(args, allow_failure):
clang_cmd = [
config.clang.strip(),
f"--target={config.target_triple}",
]
clang_cmd.extend(args)
path = None
try:
result = subprocess.run(
clang_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True
)
path = result.stdout.decode().strip()
except subprocess.CalledProcessError as e:
msg = f"Failed to run {clang_cmd}\nrc:{e.returncode}\nstdout:{e.stdout}\ne.stderr{e.stderr}"
if allow_failure:
lit_config.warning(msg)
else:
lit_config.fatal(msg)
return path, clang_cmd

# Try using `-print-runtime-dir`. This is only supported by very new versions of Clang.
# so allow failure here.
runtime_dir, clang_cmd = get_path_from_clang(
Expand Down Expand Up @@ -168,10 +169,45 @@ def push_dynamic_library_lookup_path(config, new_path):
r"/i386(?=-[^/]+$)", "/x86_64", config.compiler_rt_libdir
)


# Check if the test compiler resource dir matches the local build directory
# (which happens with -DLLVM_ENABLE_PROJECTS=clang;compiler-rt) or if we are
# using an installed clang to test compiler-rt standalone. In the latter case
# we may need to override the resource dir to match the path of the just-built
# compiler-rt libraries.
test_cc_resource_dir, _ = get_path_from_clang(
shlex.split(config.target_cflags) + ["-print-resource-dir"], allow_failure=True
)
# Normalize the path for comparison
if test_cc_resource_dir is not None:
test_cc_resource_dir = os.path.realpath(test_cc_resource_dir)
if lit_config.debug:
lit_config.note(f"Resource dir for {config.clang} is {test_cc_resource_dir}")
local_build_resource_dir = os.path.realpath(config.compiler_rt_output_dir)
if test_cc_resource_dir != local_build_resource_dir:
if config.test_standalone_build_libs and config.compiler_id == "Clang":
if lit_config.debug:
lit_config.note(
f"Overriding test compiler resource dir to use "
f'libraries in "{config.compiler_rt_libdir}"'
)
# Ensure that we use the just-built static libraries when linking by
# overriding the Clang resource directory. Additionally, we want to use
# the builtin headers shipped with clang (e.g. stdint.h), so we
# explicitly add this as an include path (since the headers are not
# going to be in the current compiler-rt build directory).
# We also tell the linker to add an RPATH entry for the local library
# directory so that the just-built shared libraries are used.
config.target_cflags += f" -nobuiltininc"
Copy link
Member

@MaskRay MaskRay Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered whether target_cflags can be made to a list instead of space-separated str, but I think it doesn't really improve.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this would be cleaner, I will submit an independent cleanup PR.

config.target_cflags += f" -I{config.compiler_rt_src_root}/include"
config.target_cflags += f" -idirafter {test_cc_resource_dir}/include"
config.target_cflags += f" -resource-dir={config.compiler_rt_output_dir}"
config.target_cflags += f" -Wl,-rpath,{config.compiler_rt_libdir}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the fix for Windows that was made in 10b1864, this bit here also would need a similar condition - otherwise testing fails with the same error, see e.g. https://github.com/mstorsjo/llvm-mingw/actions/runs/8592846078/job/23549755414.

I see that this whole PR was reverted later, but when preparing for a reland, make sure to conditionalize this case of -Wl,-rpath as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Unfortunately I don't have a way of testing this on Windows, and I was hoping the pre-commit CI would have caught it but I guess that does not include mingw.


# Ask the compiler for the path to libraries it is going to use. If this
# doesn't match config.compiler_rt_libdir then it means we might be testing the
# compiler's own runtime libraries rather than the ones we just built.
# Warn about about this and handle appropriately.
# Warn about this and handle appropriately.
compiler_libdir = find_compiler_libdir()
if compiler_libdir:
compiler_rt_libdir_real = os.path.realpath(config.compiler_rt_libdir)
Expand All @@ -182,7 +218,7 @@ def push_dynamic_library_lookup_path(config, new_path):
f'compiler-rt libdir: "{compiler_rt_libdir_real}"'
)
if config.test_standalone_build_libs:
# Use just built runtime libraries, i.e. the the libraries this built just built.
# Use just built runtime libraries, i.e. the libraries this build just built.
if not config.test_suite_supports_overriding_runtime_lib_path:
# Test suite doesn't support this configuration.
# TODO(dliew): This should be an error but it seems several bots are
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/test/lit.common.configured.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
set_default("python_executable", "@Python3_EXECUTABLE@")
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
set_default("compiler_rt_intercept_libdispatch", @COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL@)
set_default("compiler_rt_output_dir", "@COMPILER_RT_RESOLVED_OUTPUT_DIR@")
set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
set_default("emulator", "@COMPILER_RT_EMULATOR@")
set_default("asan_shadow_scale", "@COMPILER_RT_ASAN_SHADOW_SCALE@")
Expand Down
9 changes: 3 additions & 6 deletions compiler-rt/test/memprof/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ macro(get_bits_for_arch arch bits)
endif()
endmacro()

set(MEMPROF_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND MEMPROF_TEST_DEPS memprof)
if(COMPILER_RT_HAS_LLD AND TARGET lld)
list(APPEND MEMPROF_TEST_DEPS lld)
endif()
set(MEMPROF_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} memprof)
if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_HAS_LLD AND TARGET lld)
list(APPEND MEMPROF_TEST_DEPS lld)
endif()
set(MEMPROF_DYNAMIC_TEST_DEPS ${MEMPROF_TEST_DEPS})

Expand Down
6 changes: 1 addition & 5 deletions compiler-rt/test/msan/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

set(MSAN_TESTSUITES)
set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} msan)

set(MSAN_TEST_ARCH ${MSAN_SUPPORTED_ARCH})
if(APPLE)
Expand Down Expand Up @@ -41,10 +41,6 @@ foreach(arch ${MSAN_TEST_ARCH})
endif()
endforeach()

if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND MSAN_TEST_DEPS msan)
endif()

if(COMPILER_RT_INCLUDE_TESTS AND
COMPILER_RT_LIBCXX_PATH AND
COMPILER_RT_LIBCXXABI_PATH)
Expand Down
Loading