Skip to content

Commit c771159

Browse files
[RTSan] Fix tests under Internal Shell (#168470)
This patch fixes the only RTSan test that was broken by enabling lit's internal shell on Darwin. This patch rewrites the test to prefix env variables with `env` and to avoid the use of subshells.
1 parent c61c5d2 commit c771159

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler-rt/test/rtsan/Darwin/dlopen.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
// RUN: %clangxx -fsanitize=realtime %s -o %t.so -shared -DSHARED_LIB
99
// RUN: %clangxx %s -o %t
1010

11-
// RUN: RTSAN_DYLIB_PATH=`%clangxx -fsanitize=realtime %s -### 2>&1 \
11+
// RUN: %clangxx -fsanitize=realtime %s -### 2>&1 \
1212
// RUN: | grep "libclang_rt.rtsan_osx_dynamic.dylib" \
13-
// RUN: | sed -e 's/.*"\(.*libclang_rt.rtsan_osx_dynamic.dylib\)".*/\1/'`
13+
// RUN: | sed -e 's/.*"\(.*libclang_rt.rtsan_osx_dynamic.dylib\)".*/\1/' \
14+
// RUN: | tr -d '\n' > %t.rtsan_dylib_path
1415

1516
// Launching a non-instrumented binary that dlopen's an instrumented library should fail.
1617
// RUN: not %run %t %t.so 2>&1 | FileCheck %s --check-prefix=CHECK-FAIL
1718
// Launching a non-instrumented binary with an explicit DYLD_INSERT_LIBRARIES should work.
18-
// RUN: DYLD_INSERT_LIBRARIES=$RTSAN_DYLIB_PATH %run %t %t.so 2>&1 | FileCheck %s
19+
// RUN: env DYLD_INSERT_LIBRARIES="%{readfile:%t.rtsan_dylib_path}" %run %t %t.so 2>&1 | FileCheck %s
1920

2021
// Launching an instrumented binary with the DYLD_INSERT_LIBRARIES env variable has no error
2122
// RUN: %clangxx -fsanitize=realtime %s -o %t
22-
// RUN: DYLD_INSERT_LIBRARIES=$RTSAN_DYLIB_PATH %run %t %t.so 2>&1 | FileCheck %s --check-prefix=CHECK-INSTRUMENTED
23+
// RUN: env DYLD_INSERT_LIBRARIES="%{readfile:%t.rtsan_dylib_path}" %run %t %t.so 2>&1 | FileCheck %s --check-prefix=CHECK-INSTRUMENTED
2324

2425
#include <dlfcn.h>
2526
#include <stdio.h>

0 commit comments

Comments
 (0)