aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/test
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/asan/TestCases/Linux/long-object-path.cpp6
-rw-r--r--compiler-rt/test/fuzzer/SigTrapTest.cpp29
-rw-r--r--compiler-rt/test/fuzzer/afl-driver-stderr.test3
-rw-r--r--compiler-rt/test/fuzzer/sig-trap.test11
-rw-r--r--compiler-rt/test/memprof/TestCases/memprof_histogram_uint8.cpp38
-rw-r--r--compiler-rt/test/rtsan/pthread_cond_wait.cpp48
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c9
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/alignment-assumption.c2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/icall.c4
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/implicit-integer-sign-change.c2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation-or-sign-change.c2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation.c2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/implicit-unsigned-integer-truncation.c2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/local_bounds.cpp8
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/nullptr-and-nonzero-offset.c4
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/override-callback.c6
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/recover-dedup-limit.cpp2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/recover-dedup.cpp2
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c4
-rw-r--r--compiler-rt/test/ubsan_minimal/TestCases/uadd-overflow.cpp4
-rw-r--r--compiler-rt/test/ubsan_minimal/lit.common.cfg.py10
-rw-r--r--compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp8
-rw-r--r--compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp8
23 files changed, 175 insertions, 39 deletions
diff --git a/compiler-rt/test/asan/TestCases/Linux/long-object-path.cpp b/compiler-rt/test/asan/TestCases/Linux/long-object-path.cpp
index 592b0ab..ffc2fbf 100644
--- a/compiler-rt/test/asan/TestCases/Linux/long-object-path.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/long-object-path.cpp
@@ -1,6 +1,6 @@
-// RUN: mkdir -p %T/a-long-directory-name-to-test-allocations-for-exceptions-in-_dl_lookup_symbol_x-since-glibc-2.27
-// RUN: %clangxx_asan -g %s -o %T/long-object-path
-// RUN: %run %T/a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../long-object-path
+// RUN: mkdir -p %t.dir/a-long-directory-name-to-test-allocations-for-exceptions-in-_dl_lookup_symbol_x-since-glibc-2.27
+// RUN: %clangxx_asan -g %s -o %t.dir/long-object-path
+// RUN: %run %t.dir/a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../long-object-path
int main(void) {
return 0;
diff --git a/compiler-rt/test/fuzzer/SigTrapTest.cpp b/compiler-rt/test/fuzzer/SigTrapTest.cpp
new file mode 100644
index 0000000..c3019a1
--- /dev/null
+++ b/compiler-rt/test/fuzzer/SigTrapTest.cpp
@@ -0,0 +1,29 @@
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+// Simple test for a fuzzer. The fuzzer must find the string "Hi!".
+#include <assert.h>
+#include <cstddef>
+#include <cstdint>
+#include <cstdlib>
+#include <iostream>
+#include <ostream>
+#include <signal.h>
+
+static volatile int Sink;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ assert(Data);
+ if (Size > 0 && Data[0] == 'H') {
+ Sink = 1;
+ if (Size > 1 && Data[1] == 'i') {
+ Sink = 2;
+ if (Size > 2 && Data[2] == '!') {
+ std::cout << "BINGO; Found the target, exiting\n" << std::flush;
+ raise(SIGTRAP);
+ }
+ }
+ }
+ return 0;
+}
diff --git a/compiler-rt/test/fuzzer/afl-driver-stderr.test b/compiler-rt/test/fuzzer/afl-driver-stderr.test
index 4b0c3b4..1ee0960 100644
--- a/compiler-rt/test/fuzzer/afl-driver-stderr.test
+++ b/compiler-rt/test/fuzzer/afl-driver-stderr.test
@@ -7,7 +7,8 @@ RUN: %no_fuzzer_cpp_compiler %S/AFLDriverTest.cpp %libfuzzer_src/afl/afl_driver.
RUN: env -u AFL_DRIVER_STDERR_DUPLICATE_FILENAME %run %t-AFLDriverTest
; Test that specifying an invalid file causes a crash.
-RUN: env ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%T" not --crash %run %t-AFLDriverTest
+RUN: mkdir -p %t.dir
+RUN: env ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%t.dir" not --crash %run %t-AFLDriverTest
; Test that a file is created when specified as the duplicate stderr.
RUN: env AFL_DRIVER_STDERR_DUPLICATE_FILENAME=%t %run %t-AFLDriverTest
diff --git a/compiler-rt/test/fuzzer/sig-trap.test b/compiler-rt/test/fuzzer/sig-trap.test
new file mode 100644
index 0000000..30d9d47
--- /dev/null
+++ b/compiler-rt/test/fuzzer/sig-trap.test
@@ -0,0 +1,11 @@
+# Check that libFuzzer handles SIGTRAP; disabled on Windows due to reliance on
+# posix only features
+UNSUPPORTED: target={{.*windows.*}}
+
+RUN: %cpp_compiler %S/SigTrapTest.cpp -o %t
+
+RUN: not %run %t 2>&1 | FileCheck %s
+CHECK: BINGO
+CHECK: ERROR: libFuzzer: deadly signal
+
+RUN: trap "%run %t -handle_trap=0" TRAP
diff --git a/compiler-rt/test/memprof/TestCases/memprof_histogram_uint8.cpp b/compiler-rt/test/memprof/TestCases/memprof_histogram_uint8.cpp
new file mode 100644
index 0000000..ef6fb33
--- /dev/null
+++ b/compiler-rt/test/memprof/TestCases/memprof_histogram_uint8.cpp
@@ -0,0 +1,38 @@
+// Test the histogram support in memprof using the text format output.
+// Shadow memory counters per object are limited to 8b. In memory counters
+// aggregating counts across multiple objects are 64b.
+
+// RUN: %clangxx_memprof -O0 -mllvm -memprof-histogram -mllvm -memprof-use-callbacks=true %s -o %t
+// RUN: %env_memprof_opts=print_text=1:histogram=1:log_path=stdout %run %t 2>&1 | FileCheck %s
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main() {
+ // Allocate memory that will create a histogram
+ char *buffer = (char *)malloc(1024);
+ if (!buffer)
+ return 1;
+
+ for (int i = 0; i < 10; ++i) {
+ // Access every 8th byte (since shadow granularity is 8b.
+ buffer[i * 8] = 'A';
+ }
+
+ for (int j = 0; j < 200; ++j) {
+ buffer[8] = 'B'; // Count = previous count + 200
+ }
+
+ for (int j = 0; j < 400; ++j) {
+ buffer[16] = 'B'; // Count is saturated at 255
+ }
+
+ // Free the memory to trigger MIB creation with histogram
+ free(buffer);
+
+ printf("Test completed successfully\n");
+ return 0;
+}
+
+// CHECK: AccessCountHistogram[128]: 1 201 255 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+// CHECK: Test completed successfully
diff --git a/compiler-rt/test/rtsan/pthread_cond_wait.cpp b/compiler-rt/test/rtsan/pthread_cond_wait.cpp
new file mode 100644
index 0000000..29afbf4b
--- /dev/null
+++ b/compiler-rt/test/rtsan/pthread_cond_wait.cpp
@@ -0,0 +1,48 @@
+// RUN: %clangxx -fsanitize=realtime %s -o %t
+// RUN: %run %t 2>&1 | FileCheck %s
+
+// UNSUPPORTED: ios
+
+// Intent: Ensures that pthread_cond_signal does not segfault under rtsan
+// See issue #146120
+
+#include <condition_variable>
+#include <future>
+#include <mutex>
+#include <thread>
+
+#include <iostream>
+
+int main() {
+ std::cout << "Entry to main!" << std::endl;
+
+
+ // TODO: This is disabled because it does cause a test failure
+ /*
+ std::mutex mut;
+ std::condition_variable cv;
+ bool go{false};
+
+ const auto fut = std::async(std::launch::async, [&] {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ {
+ std::unique_lock<std::mutex> lock(mut);
+ go = true;
+ }
+ cv.notify_one();
+ });
+
+ std::unique_lock<std::mutex> lock(mut);
+ // normal wait is fine
+ // cv.wait(lock, [&] { return go; });
+ // but timed wait could segfault
+
+ // NOTE: When a fix for the pthread_cond issue #146120 is fixed, uncomment this line
+ //cv.wait_for(lock, std::chrono::milliseconds(200), [&] { return go; });
+ */
+
+ std::cout << "Exit from main!" << std::endl;
+}
+
+// CHECK: Entry to main!
+// CHECK-NEXT: Exit from main!
diff --git a/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c b/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c
index 8e13105..bf0e4e1 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c
@@ -1,12 +1,13 @@
-// RUN: %clang %s -o %T/suffix-log-path_test-binary
+// RUN: rm -rf %t.dir
+// RUN: mkdir -p %t.dir
+// RUN: %clang %s -o %t.dir/suffix-log-path_test-binary
// The glob below requires bash.
// REQUIRES: shell
// Good log_path with suffix.
-// RUN: rm -f %T/sanitizer.log.*.txt
-// RUN: %env_tool_opts=log_path=%T/sanitizer.log:log_exe_name=1:log_suffix=.txt %run %T/suffix-log-path_test-binary 2> %t.out
-// RUN: FileCheck %s < %T/sanitizer.log.suffix-log-path_test-binary.*.txt
+// RUN: %env_tool_opts=log_path=%t.dir/sanitizer.log:log_exe_name=1:log_suffix=.txt %run %t.dir/suffix-log-path_test-binary 2> %t.out
+// RUN: FileCheck %s < %t.dir/sanitizer.log.suffix-log-path_test-binary.*.txt
// UNSUPPORTED: ios, android
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/alignment-assumption.c b/compiler-rt/test/ubsan_minimal/TestCases/alignment-assumption.c
index acc3e855..134c143 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/alignment-assumption.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/alignment-assumption.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fsanitize=alignment %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_min_runtime -fsanitize=alignment %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
#include <stdlib.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/icall.c b/compiler-rt/test/ubsan_minimal/TestCases/icall.c
index 6948057..a0953b8 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/icall.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/icall.c
@@ -1,5 +1,5 @@
-// RUN: %clang -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-recover=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clang_min_runtime -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
+// RUN: %clang_min_runtime -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-recover=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && %run %t 2>&1 | FileCheck %s
// REQUIRES: lld-available, cfi
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/implicit-integer-sign-change.c b/compiler-rt/test/ubsan_minimal/TestCases/implicit-integer-sign-change.c
index 0f1bbbf..1e3a14c 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/implicit-integer-sign-change.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/implicit-integer-sign-change.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
#include <stdint.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation-or-sign-change.c b/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation-or-sign-change.c
index e9f26dd..a05af6b 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation-or-sign-change.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation-or-sign-change.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_min_runtime -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
#include <stdint.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation.c b/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation.c
index dc8d775..945c033 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/implicit-signed-integer-truncation.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_min_runtime -fsanitize=implicit-signed-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
#include <stdint.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/implicit-unsigned-integer-truncation.c b/compiler-rt/test/ubsan_minimal/TestCases/implicit-unsigned-integer-truncation.c
index 77d38f5..35515b7 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/implicit-unsigned-integer-truncation.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/implicit-unsigned-integer-truncation.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fsanitize=implicit-unsigned-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_min_runtime -fsanitize=implicit-unsigned-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
#include <stdint.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/local_bounds.cpp b/compiler-rt/test/ubsan_minimal/TestCases/local_bounds.cpp
index c972e1e..4b542fa 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/local_bounds.cpp
+++ b/compiler-rt/test/ubsan_minimal/TestCases/local_bounds.cpp
@@ -1,7 +1,7 @@
-// RUN: %clangxx -fsanitize=local-bounds %s -O3 -o %t && %run %t 1
-// RUN: %clangxx -fsanitize=local-bounds %s -O3 -o %t && not --crash %run %t 3
-// RUN: %clangxx -fsanitize=local-bounds -fno-sanitize-trap=local-bounds %s -O3 -o %t && not --crash %run %t 3 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=local-bounds -fno-sanitize-trap=local-bounds -fsanitize-recover=local-bounds %s -O3 -o %t && %run %t 3 2>&1 | FileCheck %s
+// RUN: %clangxx_min_runtime -fsanitize=local-bounds %s -O3 -o %t && %run %t 1
+// RUN: %clangxx_min_runtime -fsanitize=local-bounds %s -O3 -o %t && not --crash %run %t 3
+// RUN: %clangxx_min_runtime -fsanitize=local-bounds -fno-sanitize-trap=local-bounds %s -O3 -o %t && not --crash %run %t 3 2>&1 | FileCheck %s
+// RUN: %clangxx_min_runtime -fsanitize=local-bounds -fno-sanitize-trap=local-bounds -fsanitize-recover=local-bounds %s -O3 -o %t && %run %t 3 2>&1 | FileCheck %s
#include <cstdlib>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/nullptr-and-nonzero-offset.c b/compiler-rt/test/ubsan_minimal/TestCases/nullptr-and-nonzero-offset.c
index bba9a38..7378a17 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/nullptr-and-nonzero-offset.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/nullptr-and-nonzero-offset.c
@@ -1,5 +1,5 @@
-// RUN: %clang -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
-// RUN: %clangxx -x c++ -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
+// RUN: %clang_min_runtime -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
+// RUN: %clangxx_min_runtime -x c++ -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
#include <stdlib.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/override-callback.c b/compiler-rt/test/ubsan_minimal/TestCases/override-callback.c
index 9d326ff..aaed134 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/override-callback.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/override-callback.c
@@ -1,6 +1,6 @@
-// RUN: %clang -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all -DOVERRIDE=1 %s -o %t && not --crash %run %t 2>&1 | FileCheck %s --check-prefixes=FATAL
+// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
+// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all -DOVERRIDE=1 %s -o %t && not --crash %run %t 2>&1 | FileCheck %s --check-prefixes=FATAL
#include <stdint.h>
#include <stdio.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup-limit.cpp b/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup-limit.cpp
index faa2b66..ebc8901 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup-limit.cpp
+++ b/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup-limit.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -fsanitize=signed-integer-overflow -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_min_runtime -fsanitize=signed-integer-overflow -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
#include <stdint.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup.cpp b/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup.cpp
index b7c9ddc..0b54579 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup.cpp
+++ b/compiler-rt/test/ubsan_minimal/TestCases/recover-dedup.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -w -fsanitize=signed-integer-overflow,nullability-return,returns-nonnull-attribute -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_min_runtime -w -fsanitize=signed-integer-overflow,nullability-return,returns-nonnull-attribute -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
#include <stdint.h>
#include <stdio.h>
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c b/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c
index 1da049f..abc1073 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c
@@ -3,11 +3,11 @@
//
// REQUIRES: x86_64-darwin
-// RUN: nm -jgU `%clangxx -fsanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_minimal_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_minimal_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
+// RUN: nm -jgU `%clangxx_min_runtime -fsanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_minimal_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_minimal_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
// RUN: | sed 's/_minimal//g' \
// RUN: > %t.minimal.symlist
//
-// RUN: nm -jgU `%clangxx -fno-sanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
+// RUN: nm -jgU `%clangxx_min_runtime -fno-sanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
// RUN: | grep -vE "^___ubsan_handle_dynamic_type_cache_miss" \
// RUN: | grep -vE "^___ubsan_handle_cfi_bad_type" \
// RUN: | sed 's/_v1//g' \
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/uadd-overflow.cpp b/compiler-rt/test/ubsan_minimal/TestCases/uadd-overflow.cpp
index 4ae081c..e1f04d3 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/uadd-overflow.cpp
+++ b/compiler-rt/test/ubsan_minimal/TestCases/uadd-overflow.cpp
@@ -1,5 +1,5 @@
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_min_runtime -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_min_runtime -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
#include <stdint.h>
diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
index bcc0e46..33473e2 100644
--- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
+++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
@@ -27,9 +27,13 @@ target_cflags = [get_required_attr(config, "target_cflags")]
clang_ubsan_cflags = ["-fsanitize-minimal-runtime"] + target_cflags
clang_ubsan_cxxflags = config.cxx_mode_flags + clang_ubsan_cflags
-# Define %clang and %clangxx substitutions to use in test RUN lines.
-config.substitutions.append(("%clang ", build_invocation(clang_ubsan_cflags)))
-config.substitutions.append(("%clangxx ", build_invocation(clang_ubsan_cxxflags)))
+# Define %clang_min_runtime and %clangxx_min_runtime substitutions to use in test RUN lines.
+config.substitutions.append(
+ ("%clang_min_runtime ", build_invocation(clang_ubsan_cflags))
+)
+config.substitutions.append(
+ ("%clangxx_min_runtime ", build_invocation(clang_ubsan_cxxflags))
+)
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
index 4a866e2..6c94dbd 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
@@ -1,12 +1,14 @@
// RUN: %clangxx_xray -g -std=c++11 %s -o %t -fxray-modes=xray-fdr
-// RUN: rm -f fdr-inmemory-test-*
+// RUN: rm -rf %t.dir
+// RUN: mkdir -p %t.dir
+// RUN: cd %t.dir
// RUN: XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-inmemory-test- \
// RUN: verbosity=1" \
// RUN: XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
// RUN: %run %t 2>&1 | FileCheck %s
-// RUN: FILES=`find %T -name 'fdr-inmemory-test-*' | wc -l`
+// RUN: FILES=`find %t.dir -name 'fdr-inmemory-test-*' | wc -l`
// RUN: [ $FILES -eq 0 ]
-// RUN: rm -f fdr-inmemory-test-*
+// RUN: rm -rf %t.dir
//
// REQUIRES: built-in-llvm-tree
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
index b0411a2..f9288d9 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
@@ -1,12 +1,14 @@
// RUN: %clangxx_xray -g -std=c++11 %s -o %t -fxray-modes=xray-fdr
-// RUN: rm -f fdr-inmemory-test-*
+// RUN: rm -rf %t.dir
+// RUN: mkdir -p %t.dir
+// RUN: cd %t.dir
// RUN: XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-inmemory-test- \
// RUN: verbosity=1" \
// RUN: XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
// RUN: %run %t 2>&1 | FileCheck %s
-// RUN: FILES=`find %T -name 'fdr-inmemory-test-*' | wc -l`
+// RUN: FILES=`find %t.dir -name 'fdr-inmemory-test-*' | wc -l`
// RUN: [ $FILES -eq 0 ]
-// RUN: rm -f fdr-inmemory-test-*
+// RUN: rm -rf %t.dir
//
// REQUIRES: built-in-llvm-tree