Index: test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cc =================================================================== --- test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cc +++ test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cc @@ -3,30 +3,31 @@ // UNSUPPORTED: ios -// RUN: mkdir -p %T/dyld_insert_libraries_reexec +// RUN: rm -rf %t +// RUN: mkdir -p %t // RUN: cp `%clang_asan %s -fsanitize=address -### 2>&1 \ // RUN: | grep "libclang_rt.asan_osx_dynamic.dylib" \ // RUN: | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/'` \ -// RUN: %T/dyld_insert_libraries_reexec/libclang_rt.asan_osx_dynamic.dylib -// RUN: %clangxx_asan %s -o %T/dyld_insert_libraries_reexec/a.out +// RUN: %t/libclang_rt.asan_osx_dynamic.dylib +// RUN: %clangxx_asan %s -o %t/a.out // RUN: %env_asan_opts=verbosity=1 \ // RUN: DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib \ -// RUN: %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \ +// RUN: %run %t/a.out 2>&1 \ // RUN: | FileCheck %s // RUN: IS_OSX_10_11_OR_HIGHER=$([ `sw_vers -productVersion | cut -d'.' -f2` -lt 11 ]; echo $?) // On OS X 10.10 and lower, if the dylib is not DYLD-inserted, ASan will re-exec. // RUN: if [ $IS_OSX_10_11_OR_HIGHER == 0 ]; then \ -// RUN: %env_asan_opts=verbosity=1 %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \ +// RUN: %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOINSERT %s; \ // RUN: fi // On OS X 10.11 and higher, we don't need to DYLD-insert anymore, and the interceptors // still installed correctly. Let's just check that things work and we don't try to re-exec. // RUN: if [ $IS_OSX_10_11_OR_HIGHER == 1 ]; then \ -// RUN: %env_asan_opts=verbosity=1 %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \ +// RUN: %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \ // RUN: | FileCheck %s; \ // RUN: fi Index: test/asan/TestCases/Darwin/dyld_insert_libraries_remove.cc =================================================================== --- test/asan/TestCases/Darwin/dyld_insert_libraries_remove.cc +++ test/asan/TestCases/Darwin/dyld_insert_libraries_remove.cc @@ -4,26 +4,27 @@ // UNSUPPORTED: ios -// RUN: mkdir -p %T/dyld_insert_libraries_remove +// RUN: rm -rf %t +// RUN: mkdir -p %t // RUN: cp `%clang_asan %s -fsanitize=address -### 2>&1 \ // RUN: | grep "libclang_rt.asan_osx_dynamic.dylib" \ // RUN: | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/'` \ -// RUN: %T/dyld_insert_libraries_remove/libclang_rt.asan_osx_dynamic.dylib +// RUN: %t/libclang_rt.asan_osx_dynamic.dylib -// RUN: %clangxx_asan %s -o %T/dyld_insert_libraries_remove/a.out +// RUN: %clangxx_asan %s -o %t/a.out // RUN: %clangxx -DSHARED_LIB %s \ -// RUN: -dynamiclib -o %T/dyld_insert_libraries_remove/dummy-so.dylib +// RUN: -dynamiclib -o %t/dummy-so.dylib -// RUN: ( cd %T/dyld_insert_libraries_remove && \ +// RUN: ( cd %t && \ // RUN: DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \ // RUN: %run ./a.out 2>&1 ) | FileCheck %s || exit 1 -// RUN: ( cd %T/dyld_insert_libraries_remove && \ +// RUN: ( cd %t && \ // RUN: DYLD_INSERT_LIBRARIES=libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \ // RUN: %run ./a.out 2>&1 ) | FileCheck %s || exit 1 -// RUN: ( cd %T/dyld_insert_libraries_remove && \ -// RUN: DYLD_INSERT_LIBRARIES=%T/dyld_insert_libraries_remove/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \ +// RUN: ( cd %t && \ +// RUN: DYLD_INSERT_LIBRARIES=%t/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \ // RUN: %run ./a.out 2>&1 ) | FileCheck %s || exit 1 #if !defined(SHARED_LIB) Index: test/asan/TestCases/Darwin/unset-insert-libraries-on-exec.cc =================================================================== --- test/asan/TestCases/Darwin/unset-insert-libraries-on-exec.cc +++ test/asan/TestCases/Darwin/unset-insert-libraries-on-exec.cc @@ -2,16 +2,16 @@ // executing other programs. // RUN: %clangxx_asan %s -o %t -// RUN: %clangxx %p/../Helpers/echo-env.cc -o %T/echo-env +// RUN: %clangxx %p/../Helpers/echo-env.cc -o %t-echo-env // RUN: %clangxx -DSHARED_LIB %s \ // RUN: -dynamiclib -o %t-darwin-dummy-shared-lib-so.dylib // Make sure DYLD_INSERT_LIBRARIES doesn't contain the runtime library before // execl(). -// RUN: %run %t %T/echo-env >/dev/null 2>&1 +// RUN: %run %t %t-echo-env >/dev/null 2>&1 // RUN: %env DYLD_INSERT_LIBRARIES=%t-darwin-dummy-shared-lib-so.dylib \ -// RUN: %run %t %T/echo-env 2>&1 | FileCheck %s || exit 1 +// RUN: %run %t %t-echo-env 2>&1 | FileCheck %s || exit 1 #if !defined(SHARED_LIB) #include Index: test/asan/TestCases/Linux/coverage-missing.cc =================================================================== --- test/asan/TestCases/Linux/coverage-missing.cc +++ 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 Index: test/asan/TestCases/Linux/interception_readdir_r_test.cc =================================================================== --- test/asan/TestCases/Linux/interception_readdir_r_test.cc +++ 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 #include Index: test/asan/TestCases/Linux/stack-trace-dlclose.cc =================================================================== --- test/asan/TestCases/Linux/stack-trace-dlclose.cc +++ 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 Index: test/asan/TestCases/Posix/asan-symbolize-bad-path.cc =================================================================== --- test/asan/TestCases/Posix/asan-symbolize-bad-path.cc +++ 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 Index: test/asan/TestCases/Posix/coverage-fork.cc =================================================================== --- test/asan/TestCases/Posix/coverage-fork.cc +++ 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 Index: test/asan/TestCases/Posix/coverage-reset.cc =================================================================== --- test/asan/TestCases/Posix/coverage-reset.cc +++ 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 Index: test/asan/TestCases/Posix/coverage.cc =================================================================== --- test/asan/TestCases/Posix/coverage.cc +++ 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: rm -r %T/coverage +// RUN: rm -r %t-dir // // https://code.google.com/p/address-sanitizer/issues/detail?id=263 // XFAIL: android Index: test/asan/TestCases/Windows/coverage-basic.cc =================================================================== --- test/asan/TestCases/Windows/coverage-basic.cc +++ 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 // Index: test/asan/TestCases/coverage-and-lsan.cc =================================================================== --- test/asan/TestCases/coverage-and-lsan.cc +++ 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 Index: test/asan/TestCases/coverage-disabled.cc =================================================================== --- test/asan/TestCases/coverage-disabled.cc +++ 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 Index: test/asan/TestCases/suppressions-exec-relative-location.cc =================================================================== --- test/asan/TestCases/suppressions-exec-relative-location.cc +++ 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. Index: test/asan/TestCases/suppressions-library.cc =================================================================== --- test/asan/TestCases/suppressions-library.cc +++ 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 Index: test/asan/TestCases/verbose-log-path_test.cc =================================================================== --- test/asan/TestCases/verbose-log-path_test.cc +++ 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 and Linux have verbose log paths now. // XFAIL: win32,android Index: test/asan/lit.cfg =================================================================== --- test/asan/lit.cfg +++ test/asan/lit.cfg @@ -198,16 +198,16 @@ if config.host_os == 'Darwin': config.substitutions.append( ("%ld_flags_rpath_exe", '-Wl,-rpath,@executable_path/ %dynamiclib') ) - config.substitutions.append( ("%ld_flags_rpath_so", '-install_name @rpath/`basename %dynamiclib`') ) + config.substitutions.append( ("%ld_flags_rpath_so", '-install_name @rpath/%xdynamiclib_filename') ) elif config.host_os == 'FreeBSD': - config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") ) + config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L`dirname %t` -l%xdynamiclib_namespec") ) config.substitutions.append( ("%ld_flags_rpath_so", '') ) elif config.host_os == 'Linux': - config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") ) + config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-rpath,\$ORIGIN -L`dirname %t` -l%xdynamiclib_namespec") ) config.substitutions.append( ("%ld_flags_rpath_so", '') ) # Must be defined after the substitutions that use %dynamiclib. -config.substitutions.append( ("%dynamiclib", '%T/%xdynamiclib_filename') ) +config.substitutions.append( ("%dynamiclib", '`dirname %t`/%xdynamiclib_filename') ) config.substitutions.append( ("%xdynamiclib_filename", 'lib%xdynamiclib_namespec.so') ) config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') ) Index: test/cfi/target_uninstrumented.cpp =================================================================== --- test/cfi/target_uninstrumented.cpp +++ test/cfi/target_uninstrumented.cpp @@ -1,5 +1,7 @@ -// RUN: %clangxx -g -DSHARED_LIB %s -fPIC -shared -o %T/target_uninstrumented-so.so -// RUN: %clangxx_cfi_diag -g %s -o %t %T/target_uninstrumented-so.so +// RUN: rm -rf %t-dir +// RUN: mkdir %t-dir +// RUN: %clangxx -g -DSHARED_LIB %s -fPIC -shared -o %t-dir/target_uninstrumented-so.so +// RUN: %clangxx_cfi_diag -g %s -o %t %t-dir/target_uninstrumented-so.so // RUN: %t 2>&1 | FileCheck %s // REQUIRES: cxxabi Index: test/msan/coverage-levels.cc =================================================================== --- test/msan/coverage-levels.cc +++ 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) { Index: test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc =================================================================== --- test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc +++ 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 // Index: test/scudo/random_shuffle.cpp =================================================================== --- test/scudo/random_shuffle.cpp +++ test/scudo/random_shuffle.cpp @@ -1,12 +1,12 @@ // RUN: %clang_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 +// RUN: mkdir %t-dir +// RUN: %run %t 100 > %t-dir/out1 +// RUN: %run %t 100 > %t-dir/out2 +// RUN: %run %t 10000 > %t-dir/out1 +// RUN: %run %t 10000 > %t-dir/out2 +// RUN: not diff %t-dir/out? +// RUN: rm -rf %t-dir // UNSUPPORTED: i386-linux,i686-linux,arm-linux,armhf-linux,aarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux // Tests that the allocator shuffles the chunks before returning to the user. Index: test/tsan/global_race.cc =================================================================== --- test/tsan/global_race.cc +++ 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" Index: test/tsan/ignore_lib0.cc =================================================================== --- test/tsan/ignore_lib0.cc +++ 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. Index: test/tsan/ignore_lib1.cc =================================================================== --- test/tsan/ignore_lib1.cc +++ 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. Index: test/tsan/ignore_lib2.cc =================================================================== --- test/tsan/ignore_lib2.cc +++ 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). Index: test/tsan/ignore_lib3.cc =================================================================== --- test/tsan/ignore_lib3.cc +++ 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). Index: test/tsan/ignore_lib4.cc =================================================================== --- test/tsan/ignore_lib4.cc +++ 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. Index: test/tsan/ignore_lib5.cc =================================================================== --- test/tsan/ignore_lib5.cc +++ 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 Index: test/tsan/simple_stack2.cc =================================================================== --- test/tsan/simple_stack2.cc +++ 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 @@ // 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)?}} ({{.*}}) Index: test/ubsan/TestCases/Misc/coverage-levels.cc =================================================================== --- test/ubsan/TestCases/Misc/coverage-levels.cc +++ 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