[llvm-branch-commits] [compiler-rt] [compiler-rt] Allow running tests without installing first (PR #83088)
Alexander Richardson via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Apr 6 17:52:48 PDT 2024
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/83088
>From 3c41df9f8fd00d86fe500d9b67e51d15a690209b Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Mon, 26 Feb 2024 16:59:08 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
=?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
[skip ci]
---
compiler-rt/cmake/Modules/CompilerRTCompile.cmake | 7 ++++++-
compiler-rt/test/dfsan/reaches_function.c | 4 ++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
index 64e7acb9afd833..8c804acb44ae4d 100644
--- a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
@@ -70,9 +70,14 @@ function(clang_compile object_file source)
if (TARGET CompilerRTUnitTestCheckCxx)
list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
endif()
+ string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
+ if (is_cxx)
+ set(compiler ${COMPILER_RT_TEST_COMPILER})
+ else()
+ set(compiler ${COMPILER_RT_TEST_CXX_COMPILER})
+ endif()
if(COMPILER_RT_STANDALONE_BUILD)
# Only add global flags in standalone build.
- string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
if(is_cxx)
string(REPLACE " " ";" global_flags "${CMAKE_CXX_FLAGS}")
else()
diff --git a/compiler-rt/test/dfsan/reaches_function.c b/compiler-rt/test/dfsan/reaches_function.c
index 9e2bcee935b2ac..afcd08cee76a0e 100644
--- a/compiler-rt/test/dfsan/reaches_function.c
+++ b/compiler-rt/test/dfsan/reaches_function.c
@@ -32,7 +32,7 @@ void my_dfsan_reaches_function_callback(dfsan_label label, dfsan_origin origin,
__attribute__((noinline)) uint64_t add(uint64_t *a, uint64_t *b) {
return *a + *b;
- // CHECK: {{.*}}compiler-rt/test/dfsan/reaches_function.c:[[# @LINE - 1]] add.dfsan
+ // CHECK: test/dfsan/reaches_function.c:[[# @LINE - 1]] add.dfsan
// CHECK-ORIGIN-TRACKING: Origin value: 0x10000002, Taint value was stored to memory at
// CHECK-ORIGIN-TRACKING: #0 {{.*}} in add.dfsan {{.*}}compiler-rt/test/dfsan/reaches_function.c:[[# @LINE - 3]]:{{.*}}
// CHECK-ORIGIN-TRACKING: Origin value: 0x1, Taint value was created at
@@ -54,7 +54,7 @@ int main(int argc, char *argv[]) {
dfsan_set_label(8, &a, sizeof(a));
uint64_t c = add(&a, &b);
- // CHECK: {{.*}}compiler-rt/test/dfsan/reaches_function.c:[[# @LINE - 1]] main
+ // CHECK: test/dfsan/reaches_function.c:[[# @LINE - 1]] main
// CHECK-ORIGIN-TRACKING: Origin value: 0x10000002, Taint value was stored to memory at
// CHECK-ORIGIN-TRACKING: #0 {{.*}} in add.dfsan {{.*}}compiler-rt/test/dfsan/reaches_function.c:{{.*}}
// CHECK-ORIGIN-TRACKING: Origin value: 0x1, Taint value was created at
>From c4cb96509ce30182f4fecdd21bf36f6dd94e8d68 Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Sun, 3 Mar 2024 14:09:59 -0800
Subject: [PATCH 2/2] fix python formatting
Created using spr 1.3.6-beta.1
---
compiler-rt/test/lit.common.cfg.py | 7 +++++--
compiler-rt/test/safestack/lit.cfg.py | 10 ++++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 5d96bf7e1a58a7..aef07427acf2e4 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -34,6 +34,7 @@ def get_path_from_clang(args, allow_failure):
lit_config.fatal(msg)
return path, clang_cmd
+
def find_compiler_libdir():
"""
Returns the path to library resource directory used
@@ -186,8 +187,10 @@ def push_dynamic_library_lookup_path(config, new_path):
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}"')
+ 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
diff --git a/compiler-rt/test/safestack/lit.cfg.py b/compiler-rt/test/safestack/lit.cfg.py
index bdc316e2f6bc74..aadb8bf0d5c77b 100644
--- a/compiler-rt/test/safestack/lit.cfg.py
+++ b/compiler-rt/test/safestack/lit.cfg.py
@@ -13,10 +13,16 @@
# Add clang substitutions.
config.substitutions.append(
- ("%clang_nosafestack ", config.clang + config.target_cflags + " -O0 -fno-sanitize=safe-stack ")
+ (
+ "%clang_nosafestack ",
+ config.clang + config.target_cflags + " -O0 -fno-sanitize=safe-stack ",
+ )
)
config.substitutions.append(
- ("%clang_safestack ", config.clang + config.target_cflags + " -O0 -fsanitize=safe-stack ")
+ (
+ "%clang_safestack ",
+ config.clang + config.target_cflags + " -O0 -fsanitize=safe-stack ",
+ )
)
if config.lto_supported:
More information about the llvm-branch-commits
mailing list