diff options
author | Filipe Cabecinhas <me@filcab.net> | 2018-07-10 12:53:46 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2018-07-10 12:53:46 +0000 |
commit | 6a9c719ee1be4562a9e16f2c71ac3e51ef9c4292 (patch) | |
tree | a18dfda132f1d426c78fc922df9774afae991a76 | |
parent | a15364152cf4d6267a82b616151de301291f2f5b (diff) | |
download | bcm5719-llvm-6a9c719ee1be4562a9e16f2c71ac3e51ef9c4292.tar.gz bcm5719-llvm-6a9c719ee1be4562a9e16f2c71ac3e51ef9c4292.zip |
[compiler-rt] Get rid of "%T" expansions
Summary:
Original patch by Kuba Mracek
The %T lit expansion expands to a common directory shared between all
the tests in the same directory, which is unexpected and unintuitive,
and more importantly, it's been a source of subtle race conditions and
flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it
would be best to simply ban %T and only keep %t, which is unique to each
test. When a test needs a temporary directory, it can just create one
using mkdir %t.
This patch removes %T in compiler-rt.
Differential Revision: https://reviews.llvm.org/D48618
llvm-svn: 336661
25 files changed, 133 insertions, 105 deletions
diff --git a/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cc b/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cc index 585aee69a02..32aada645de 100644 --- a/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cc +++ b/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cc @@ -2,18 +2,18 @@ // First case: coverage from executable. main() is called on every code path. // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t -DFOOBAR -DMAIN -// RUN: rm -rf %T/coverage-missing -// RUN: mkdir -p %T/coverage-missing -// RUN: cd %T/coverage-missing -// RUN: %env_asan_opts=coverage=1:coverage_dir=%T/coverage-missing %run %t +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir +// RUN: cd %t-dir +// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t // RUN: %sancov print *.sancov > main.txt // RUN: rm *.sancov // RUN: count 1 < main.txt -// RUN: %env_asan_opts=coverage=1:coverage_dir=%T/coverage-missing %run %t x +// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x // RUN: %sancov print *.sancov > foo.txt // RUN: rm *.sancov // RUN: count 3 < foo.txt -// RUN: %env_asan_opts=coverage=1:coverage_dir=%T/coverage-missing %run %t x x +// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x // RUN: %sancov print *.sancov > bar.txt // RUN: rm *.sancov // RUN: count 4 < bar.txt @@ -26,18 +26,18 @@ // RUN: not grep "^<" %t.log // Second case: coverage from DSO. -// cd %T +// cd %t-dir // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %dynamiclib -DFOOBAR -shared -fPIC // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %dynamiclib -o %t -DMAIN // RUN: cd .. -// RUN: rm -rf %T/coverage-missing -// RUN: mkdir -p %T/coverage-missing -// RUN: cd %T/coverage-missing -// RUN: %env_asan_opts=coverage=1:coverage_dir=%T/coverage-missing %run %t x +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir +// RUN: cd %t-dir +// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x // RUN: %sancov print %xdynamiclib_filename.*.sancov > foo.txt // RUN: rm *.sancov // RUN: count 2 < foo.txt -// RUN: %env_asan_opts=coverage=1:coverage_dir=%T/coverage-missing %run %t x x +// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x // RUN: %sancov print %xdynamiclib_filename.*.sancov > bar.txt // RUN: rm *.sancov // RUN: count 3 < bar.txt diff --git a/compiler-rt/test/asan/TestCases/Linux/interception_readdir_r_test.cc b/compiler-rt/test/asan/TestCases/Linux/interception_readdir_r_test.cc index 93b553c3744..987dff27523 100644 --- a/compiler-rt/test/asan/TestCases/Linux/interception_readdir_r_test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/interception_readdir_r_test.cc @@ -1,15 +1,18 @@ // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 // XFAIL: android + +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir // -// RUN: %clangxx_asan -O0 %s -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O1 %s -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O2 %s -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 %s -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O2 %s -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s // -// RUN: %clangxx_asan -O0 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O1 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O2 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%T"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O2 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -D_FILE_OFFSET_BITS=64 -DTEMP_DIR='"'"%t-dir"'"' -o %t && %run %t 2>&1 | FileCheck %s #include <dirent.h> #include <memory.h> diff --git a/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc b/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc index e604f1e4f73..899e0dfc6bd 100644 --- a/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc +++ b/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc @@ -1,8 +1,10 @@ // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 // XFAIL: android // -// RUN: %clangxx_asan -DSHARED %s -shared -o %T/stack_trace_dlclose.so -fPIC -// RUN: %clangxx_asan -DSO_DIR=\"%T\" %s %libdl -o %t +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir +// RUN: %clangxx_asan -DSHARED %s -shared -o %t-dir/stack_trace_dlclose.so -fPIC +// RUN: %clangxx_asan -DSO_DIR=\"%t-dir\" %s %libdl -o %t // RUN: %env_asan_opts=exitcode=0 %run %t 2>&1 | FileCheck %s // REQUIRES: stable-runtime diff --git a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc index 22c03e8ddce..3f93122e909 100644 --- a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc +++ b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc @@ -1,4 +1,4 @@ // Test that asan_symbolize does not hang when provided with an non-existing // path. -// RUN: echo '#0 0xabcdabcd (%T/bad/path+0x1234)' | %asan_symbolize | FileCheck %s +// RUN: echo '#0 0xabcdabcd (%t/bad/path+0x1234)' | %asan_symbolize | FileCheck %s // CHECK: #0 0xabcdabcd diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cc b/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cc index da6e3c2c1b3..22d2e35842a 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cc +++ b/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t -// RUN: rm -rf %T/coverage-fork -// RUN: mkdir -p %T/coverage-fork && cd %T/coverage-fork +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir && cd %t-dir // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s // // UNSUPPORTED: android diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cc b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cc index 201bf8e5325..6d76a309b76 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cc +++ b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t -// RUN: rm -rf %T/coverage-reset && mkdir -p %T/coverage-reset && cd %T/coverage-reset +// RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s // // UNSUPPORTED: ios diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage.cc b/compiler-rt/test/asan/TestCases/Posix/coverage.cc index 570cd6650a1..12a88402eb5 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage.cc +++ b/compiler-rt/test/asan/TestCases/Posix/coverage.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t -// RUN: rm -rf %T/coverage && mkdir -p %T/coverage && cd %T/coverage +// RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-main // RUN: %sancov print coverage.*sancov 2>&1 | FileCheck %s --check-prefix=CHECK-SANCOV1 // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-foo @@ -14,7 +14,7 @@ // RUN: %sancov print merged-cov 2>&1 | FileCheck %s --check-prefix=CHECK-SANCOV2 // RUN: %env_asan_opts=coverage=1:verbosity=1 not %run %t foo bar 4 2>&1 | FileCheck %s --check-prefix=CHECK-report // RUN: %env_asan_opts=coverage=1:verbosity=1 not %run %t foo bar 4 5 2>&1 | FileCheck %s --check-prefix=CHECK-segv -// RUN: cd .. && rm -r %T/coverage +// RUN: cd .. && rm -rf %t-dir // // https://code.google.com/p/address-sanitizer/issues/detail?id=263 // XFAIL: android diff --git a/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc b/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc index 918872f18f9..1469e1c30ae 100644 --- a/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc +++ b/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc @@ -1,5 +1,5 @@ -// RUN: rm -rf %T/coverage-basic -// RUN: mkdir %T/coverage-basic && cd %T/coverage-basic +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir && cd %t-dir // RUN: %clangxx_asan -fsanitize-coverage=func %s -o test.exe // RUN: %env_asan_opts=coverage=1 %run ./test.exe // diff --git a/compiler-rt/test/asan/TestCases/coverage-and-lsan.cc b/compiler-rt/test/asan/TestCases/coverage-and-lsan.cc index 591b4e93fac..60851dabb6b 100644 --- a/compiler-rt/test/asan/TestCases/coverage-and-lsan.cc +++ b/compiler-rt/test/asan/TestCases/coverage-and-lsan.cc @@ -2,11 +2,11 @@ // // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t // -// RUN: rm -rf %T/coverage-and-lsan +// RUN: rm -rf %t-dir // -// RUN: mkdir -p %T/coverage-and-lsan/normal -// RUN: %env_asan_opts=coverage=1:coverage_dir=%T/coverage-and-lsan:verbosity=1 not %run %t 2>&1 | FileCheck %s -// RUN: %sancov print %T/coverage-and-lsan/*.sancov 2>&1 +// RUN: mkdir -p %t-dir +// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir:verbosity=1 not %run %t 2>&1 | FileCheck %s +// RUN: %sancov print %t-dir/*.sancov 2>&1 // // REQUIRES: leak-detection diff --git a/compiler-rt/test/asan/TestCases/coverage-disabled.cc b/compiler-rt/test/asan/TestCases/coverage-disabled.cc index b225035ee4c..46a822dff08 100644 --- a/compiler-rt/test/asan/TestCases/coverage-disabled.cc +++ b/compiler-rt/test/asan/TestCases/coverage-disabled.cc @@ -1,12 +1,12 @@ // Test that no data is collected without a runtime flag. // -// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir // -// RUN: rm -rf %T/coverage-disabled +// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t // -// RUN: mkdir -p %T/coverage-disabled/normal -// RUN: %env_asan_opts=coverage_direct=0:coverage_dir='"%T/coverage-disabled/normal"':verbosity=1 %run %t -// RUN: not %sancov print %T/coverage-disabled/normal/*.sancov 2>&1 +// RUN: %env_asan_opts=coverage_direct=0:coverage_dir='"%t-dir"':verbosity=1 %run %t +// RUN: not %sancov print %t-dir/*.sancov 2>&1 // // UNSUPPORTED: android diff --git a/compiler-rt/test/asan/TestCases/suppressions-exec-relative-location.cc b/compiler-rt/test/asan/TestCases/suppressions-exec-relative-location.cc index d4e214d35a0..d7497566a8c 100644 --- a/compiler-rt/test/asan/TestCases/suppressions-exec-relative-location.cc +++ b/compiler-rt/test/asan/TestCases/suppressions-exec-relative-location.cc @@ -4,15 +4,15 @@ // If the executable is started from a different location, we should still // find the suppression file located relative to the location of the executable. -// RUN: rm -rf %T/suppressions-exec-relative-location -// RUN: mkdir -p %T/suppressions-exec-relative-location -// RUN: %clangxx_asan -O0 %s -o %T/suppressions-exec-relative-location/exec +// RUN: rm -rf %t-dir +// RUN: mkdir -p %t-dir +// RUN: %clangxx_asan -O0 %s -o %t-dir/exec // RUN: echo "interceptor_via_fun:crash_function" > \ -// RUN: %T/suppressions-exec-relative-location/supp.txt +// RUN: %t-dir/supp.txt // RUN: %env_asan_opts=suppressions='"supp.txt"' \ -// RUN: %run %T/suppressions-exec-relative-location/exec 2>&1 | \ +// RUN: %run %t-dir/exec 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-IGNORE %s -// RUN: rm -rf %T/suppressions-exec-relative-location +// RUN: rm -rf %t-dir // If the wrong absolute path is given, we don't try to construct // a relative path with it. diff --git a/compiler-rt/test/asan/TestCases/suppressions-library.cc b/compiler-rt/test/asan/TestCases/suppressions-library.cc index e95d339168e..39ede084010 100644 --- a/compiler-rt/test/asan/TestCases/suppressions-library.cc +++ b/compiler-rt/test/asan/TestCases/suppressions-library.cc @@ -7,7 +7,7 @@ // FIXME: Remove usage of backticks around basename below. // REQUIRES: shell -// RUN: echo "interceptor_via_lib:"`basename %dynamiclib` > %t.supp +// RUN: echo "interceptor_via_lib:"%xdynamiclib_filename > %t.supp // RUN: %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s // XFAIL: android diff --git a/compiler-rt/test/asan/TestCases/verbose-log-path_test.cc b/compiler-rt/test/asan/TestCases/verbose-log-path_test.cc index 3c3db0883f6..8088ff92476 100644 --- a/compiler-rt/test/asan/TestCases/verbose-log-path_test.cc +++ b/compiler-rt/test/asan/TestCases/verbose-log-path_test.cc @@ -1,12 +1,13 @@ -// RUN: %clangxx_asan %s -o %T/verbose-log-path_test-binary +// RUN: rm -rf %t-dir && mkdir -p %t-dir +// RUN: %clangxx_asan %s -o %t-dir/verbose-log-path_test-binary // The glob below requires bash. // REQUIRES: shell // Good log_path. -// RUN: rm -f %T/asan.log.* -// RUN: %env_asan_opts=log_path=%T/asan.log:log_exe_name=1 not %run %T/verbose-log-path_test-binary 2> %t.out -// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %T/asan.log.verbose-log-path_test-binary.* +// RUN: rm -f %t-dir/asan.log.* +// RUN: %env_asan_opts=log_path=%t-dir/asan.log:log_exe_name=1 not %run %t-dir/verbose-log-path_test-binary 2> %t.out +// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t-dir/asan.log.verbose-log-path_test-binary.* // FIXME: only FreeBSD, NetBSD and Linux have verbose log paths now. // XFAIL: win32,android diff --git a/compiler-rt/test/msan/coverage-levels.cc b/compiler-rt/test/msan/coverage-levels.cc index b881cecac7e..5ca3b717d04 100644 --- a/compiler-rt/test/msan/coverage-levels.cc +++ b/compiler-rt/test/msan/coverage-levels.cc @@ -1,14 +1,14 @@ // Test various levels of coverage // // RUN: %clangxx_msan -DINIT_VAR=1 -O1 -fsanitize-coverage=func %s -o %t -// RUN: mkdir -p %T/coverage-levels -// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN +// RUN: mkdir -p %t-dir +// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN // RUN: %clangxx_msan -O1 -fsanitize-coverage=func %s -o %t -// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN +// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN // RUN: %clangxx_msan -O1 -fsanitize-coverage=bb %s -o %t -// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN +// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN // RUN: %clangxx_msan -O1 -fsanitize-coverage=edge %s -o %t -// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN +// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN volatile int sink; int main(int argc, char **argv) { diff --git a/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc b/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc index 69ccb7234fa..0591d356f13 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc @@ -1,5 +1,6 @@ -// RUN: %clangxx -DSHARED %s -shared -o %T/get_module_and_offset_for_pc.so -fPIC -// RUN: %clangxx -DSO_DIR=\"%T\" -O0 %s -ldl -o %t +// RUN: mkdir -p %t-dir +// RUN: %clangxx -DSHARED %s -shared -o %t-dir/get_module_and_offset_for_pc.so -fPIC +// RUN: %clangxx -DSO_DIR=\"%t-dir\" -O0 %s -ldl -o %t // RUN: %run %t 2>&1 | FileCheck %s // UNSUPPORTED: i386-darwin diff --git a/compiler-rt/test/scudo/random_shuffle.cpp b/compiler-rt/test/scudo/random_shuffle.cpp index f886cb1504e..d014dee1626 100644 --- a/compiler-rt/test/scudo/random_shuffle.cpp +++ b/compiler-rt/test/scudo/random_shuffle.cpp @@ -1,12 +1,12 @@ // RUN: %clangxx_scudo %s -o %t -// RUN: rm -rf %T/random_shuffle_tmp_dir -// RUN: mkdir %T/random_shuffle_tmp_dir -// RUN: %run %t 100 > %T/random_shuffle_tmp_dir/out1 -// RUN: %run %t 100 > %T/random_shuffle_tmp_dir/out2 -// RUN: %run %t 10000 > %T/random_shuffle_tmp_dir/out1 -// RUN: %run %t 10000 > %T/random_shuffle_tmp_dir/out2 -// RUN: not diff %T/random_shuffle_tmp_dir/out? -// RUN: rm -rf %T/random_shuffle_tmp_dir +// RUN: rm -rf %t-dir/random_shuffle_tmp_dir +// RUN: mkdir %t-dir/random_shuffle_tmp_dir +// RUN: %run %t 100 > %t-dir/random_shuffle_tmp_dir/out1 +// RUN: %run %t 100 > %t-dir/random_shuffle_tmp_dir/out2 +// RUN: %run %t 10000 > %t-dir/random_shuffle_tmp_dir/out1 +// RUN: %run %t 10000 > %t-dir/random_shuffle_tmp_dir/out2 +// RUN: not diff %t-dir/random_shuffle_tmp_dir/out? +// RUN: rm -rf %t-dir/random_shuffle_tmp_dir // Tests that the allocator shuffles the chunks before returning to the user. diff --git a/compiler-rt/test/tsan/global_race.cc b/compiler-rt/test/tsan/global_race.cc index ec26b06f5c1..01df3b6de9c 100644 --- a/compiler-rt/test/tsan/global_race.cc +++ b/compiler-rt/test/tsan/global_race.cc @@ -1,12 +1,15 @@ -// RUN: %clangxx_tsan -O1 %s -o %T/global_race.cc.exe && %deflake %run %T/global_race.cc.exe 2>&1 \ +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -o %t-dir/global_race.cc.exe && %deflake %run %t-dir/global_race.cc.exe 2>&1 \ // RUN: | FileCheck %s // Also check that memory access instrumentation can be configured by either // driver or legacy flags: -// RUN: %clangxx_tsan -O1 %s -o %T/global_race.cc.exe -fno-sanitize-thread-memory-access && not %deflake %run %T/global_race.cc.exe 2>&1 \ +// RUN: %clangxx_tsan -O1 %s -o %t-dir/global_race.cc.exe -fno-sanitize-thread-memory-access && not %deflake %run %t-dir/global_race.cc.exe 2>&1 \ // RUN: | FileCheck --allow-empty --check-prefix=CHECK-MEMORY-ACCESS-OFF %s -// RUN: %clangxx_tsan -O1 %s -o %T/global_race.cc.exe -mllvm -tsan-instrument-memory-accesses=0 && not %deflake %run %T/global_race.cc.exe 2>&1 \ +// RUN: %clangxx_tsan -O1 %s -o %t-dir/global_race.cc.exe -mllvm -tsan-instrument-memory-accesses=0 && not %deflake %run %t-dir/global_race.cc.exe 2>&1 \ // RUN: | FileCheck --allow-empty --check-prefix=CHECK-MEMORY-ACCESS-OFF %s #include "test.h" diff --git a/compiler-rt/test/tsan/ignore_lib0.cc b/compiler-rt/test/tsan/ignore_lib0.cc index 84632019fcc..2b217f21ff5 100644 --- a/compiler-rt/test/tsan/ignore_lib0.cc +++ b/compiler-rt/test/tsan/ignore_lib0.cc @@ -1,9 +1,12 @@ -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib0.so -// RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib0.so +// RUN: %clangxx_tsan -O1 %s -L%t-dir -lignore_lib0 -o %t // RUN: echo running w/o suppressions: -// RUN: env LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP +// RUN: env LD_LIBRARY_PATH=%t-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN: echo running with suppressions: -// RUN: env LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP +// RUN: env LD_LIBRARY_PATH=%t-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP // Tests that interceptors coming from a library specified in called_from_lib // suppression are ignored. diff --git a/compiler-rt/test/tsan/ignore_lib1.cc b/compiler-rt/test/tsan/ignore_lib1.cc index 5949d811ed4..1660cf3e41f 100644 --- a/compiler-rt/test/tsan/ignore_lib1.cc +++ b/compiler-rt/test/tsan/ignore_lib1.cc @@ -1,9 +1,12 @@ -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib1.so -// RUN: %clangxx_tsan -O1 %s -o %t +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib1.so +// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable // RUN: echo running w/o suppressions: -// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP +// RUN: %deflake %run %t-dir/executable | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN: echo running with suppressions: -// RUN: %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP +// RUN: %env_tsan_opts=suppressions='%s.supp' %run %t-dir/executable 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP // Tests that interceptors coming from a dynamically loaded library specified // in called_from_lib suppression are ignored. diff --git a/compiler-rt/test/tsan/ignore_lib2.cc b/compiler-rt/test/tsan/ignore_lib2.cc index 4f584b14664..e0dac567012 100644 --- a/compiler-rt/test/tsan/ignore_lib2.cc +++ b/compiler-rt/test/tsan/ignore_lib2.cc @@ -1,7 +1,10 @@ -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_0.so -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_1.so -// RUN: %clangxx_tsan -O1 %s -o %t -// RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t | FileCheck %s +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib2_0.so +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib2_1.so +// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable +// RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t-dir/executable | FileCheck %s // Tests that called_from_lib suppression matched against 2 libraries // causes program crash (this is not supported). diff --git a/compiler-rt/test/tsan/ignore_lib3.cc b/compiler-rt/test/tsan/ignore_lib3.cc index 3f7be5cf823..a5af07fdd11 100644 --- a/compiler-rt/test/tsan/ignore_lib3.cc +++ b/compiler-rt/test/tsan/ignore_lib3.cc @@ -1,6 +1,9 @@ -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib3.so -// RUN: %clangxx_tsan -O1 %s -o %t -// RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t | FileCheck %s +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib3.so +// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable +// RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t-dir/executable | FileCheck %s // Tests that unloading of a library matched against called_from_lib suppression // causes program crash (this is not supported). diff --git a/compiler-rt/test/tsan/ignore_lib4.cc b/compiler-rt/test/tsan/ignore_lib4.cc index 84d8b2768a9..da636ae3bf3 100644 --- a/compiler-rt/test/tsan/ignore_lib4.cc +++ b/compiler-rt/test/tsan/ignore_lib4.cc @@ -1,7 +1,10 @@ -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -shared -o %T/libignore_lib4.so -// RUN: %clangxx_tsan -O1 %s -o %t -// RUN: echo "called_from_lib:libignore_lib4.so" > %t.supp -// RUN: %env_tsan_opts=suppressions='%t.supp' %run %t 2>&1 | FileCheck %s +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -shared -o %t-dir/libignore_lib4.so +// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable +// RUN: echo "called_from_lib:libignore_lib4.so" > %t-dir/executable.supp +// RUN: %env_tsan_opts=suppressions='%t-dir/executable.supp' %run %t-dir/executable 2>&1 | FileCheck %s // powerpc64 big endian bots failed with "FileCheck error: '-' is empty" due // to a segmentation fault. diff --git a/compiler-rt/test/tsan/ignore_lib5.cc b/compiler-rt/test/tsan/ignore_lib5.cc index 54630d534c3..d6c3f870e49 100644 --- a/compiler-rt/test/tsan/ignore_lib5.cc +++ b/compiler-rt/test/tsan/ignore_lib5.cc @@ -1,9 +1,12 @@ -// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib1.so -// RUN: %clangxx_tsan -O1 %s -o %t +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir + +// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib1.so +// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable // RUN: echo running w/o suppressions: -// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP +// RUN: %deflake %run %t-dir/executable | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN: echo running with suppressions: -// RUN: %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP +// RUN: %env_tsan_opts=suppressions='%s.supp' %run %t-dir/executable 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP // REQUIRES: stable-runtime // UNSUPPORTED: powerpc64le diff --git a/compiler-rt/test/tsan/simple_stack2.cc b/compiler-rt/test/tsan/simple_stack2.cc index 12ee0da3109..bbea7130774 100644 --- a/compiler-rt/test/tsan/simple_stack2.cc +++ b/compiler-rt/test/tsan/simple_stack2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %T/simple_stack2.cc.exe && %deflake %run %T/simple_stack2.cc.exe | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include "test.h" int Global; @@ -44,10 +44,10 @@ int main() { // CHECK: WARNING: ThreadSanitizer: data race // CHECK-NEXT: Write of size 4 at {{.*}} by thread T1: -// CHECK-NEXT: #0 foo1{{.*}} {{.*}}simple_stack2.cc:7{{(:10)?}} ({{.*}}) -// CHECK-NEXT: #1 bar1{{.*}} {{.*}}simple_stack2.cc:14{{(:3)?}} ({{.*}}) -// CHECK-NEXT: #2 Thread1{{.*}} {{.*}}simple_stack2.cc:32{{(:3)?}} ({{.*}}) +// CHECK-NEXT: #0 foo1{{.*}} {{.*}}simple_stack2.cc:[[@LINE-40]]{{(:10)?}} ({{.*}}) +// CHECK-NEXT: #1 bar1{{.*}} {{.*}}simple_stack2.cc:[[@LINE-34]]{{(:3)?}} ({{.*}}) +// CHECK-NEXT: #2 Thread1{{.*}} {{.*}}simple_stack2.cc:[[@LINE-17]]{{(:3)?}} ({{.*}}) // CHECK: Previous read of size 4 at {{.*}} by main thread: -// CHECK-NEXT: #0 foo2{{.*}} {{.*}}simple_stack2.cc:18{{(:22)?}} ({{.*}}) -// CHECK-NEXT: #1 bar2{{.*}} {{.*}}simple_stack2.cc:27{{(:3)?}} ({{.*}}) -// CHECK-NEXT: #2 main{{.*}} {{.*}}simple_stack2.cc:40{{(:3)?}} ({{.*}}) +// CHECK-NEXT: #0 foo2{{.*}} {{.*}}simple_stack2.cc:[[@LINE-33]]{{(:22)?}} ({{.*}}) +// CHECK-NEXT: #1 bar2{{.*}} {{.*}}simple_stack2.cc:[[@LINE-25]]{{(:3)?}} ({{.*}}) +// CHECK-NEXT: #2 main{{.*}} {{.*}}simple_stack2.cc:[[@LINE-13]]{{(:3)?}} ({{.*}}) diff --git a/compiler-rt/test/ubsan/TestCases/Misc/coverage-levels.cc b/compiler-rt/test/ubsan/TestCases/Misc/coverage-levels.cc index 54d99746b4f..364f985c505 100644 --- a/compiler-rt/test/ubsan/TestCases/Misc/coverage-levels.cc +++ b/compiler-rt/test/ubsan/TestCases/Misc/coverage-levels.cc @@ -3,22 +3,22 @@ // FIXME: Port the environment variable logic below for the lit shell. // REQUIRES: shell // -// RUN: rm -rf %T/coverage-levels && mkdir %T/coverage-levels +// RUN: rm -rf %t-dir && mkdir %t-dir // RUN: %clangxx -fsanitize=shift -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t -// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN +// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN // RUN: %clangxx -fsanitize=undefined -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t -// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN +// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN // Also works without any sanitizer. // RUN: %clangxx -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t -// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN +// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=func %s -o %t -// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN +// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=bb %s -o %t -// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN +// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=edge %s -o %t -// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN +// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN // Coverage is not yet implemented in TSan. // XFAIL: ubsan-tsan |