Skip to content

Commit 546e91b

Browse files
[ASan] Make tests work with internal shell
Some minor adjustmenets around environment variables to make a handful of tests work with the internal shell that did not before. Reviewers: fmayer, alexander-shaposhnikov Reviewed By: fmayer, alexander-shaposhnikov Pull Request: #165141
1 parent a24a754 commit 546e91b

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

compiler-rt/test/asan/TestCases/log-path_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
// RUN: FileCheck %s --check-prefix=CHECK-BAD-DIR < %t.out
2626

2727
// Too long log_path.
28-
// RUN: %env_asan_opts=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \
28+
// RUN: %python -c "for i in range(0, 10000): print(i, end='')" > %t.long_log_path
29+
// RUN: %env_asan_opts=log_path=%{readfile:%t.long_log_path} \
2930
// RUN: not %run %t 2> %t.out
3031
// RUN: FileCheck %s --check-prefix=CHECK-LONG < %t.out
3132

compiler-rt/test/asan/TestCases/scariness_score_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: %clangxx_asan -O0 -mllvm -asan-use-stack-safety=0 %s -o %t
77
// On OSX and Windows, alloc_dealloc_mismatch=1 isn't 100% reliable, so it's
88
// off by default. It's safe for these tests, though, so we turn it on.
9-
// RUN: export %env_asan_opts=symbolize=0:detect_stack_use_after_return=1:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
9+
// RUN: %export_asan_opts=symbolize=0:detect_stack_use_after_return=1:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
1010
// Make sure the stack is limited (may not be the default under GNU make)
1111
// RUN: ulimit -s 4096
1212
// RUN: not %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK1
@@ -41,7 +41,7 @@
4141
// RUN: %clangxx_asan -O0 %s -o %t -fsanitize-address-use-after-return=always -mllvm -asan-use-stack-safety=0
4242
// On OSX and Windows, alloc_dealloc_mismatch=1 isn't 100% reliable, so it's
4343
// off by default. It's safe for these tests, though, so we turn it on.
44-
// RUN: export %env_asan_opts=symbolize=0:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
44+
// RUN: %export_asan_opts=symbolize=0:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
4545
// Make sure the stack is limited (may not be the default under GNU make)
4646
// RUN: ulimit -s 4096
4747
// RUN: not %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK1

compiler-rt/test/asan/lit.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def get_required_attr(config, attr_name):
4141
config.substitutions.append(
4242
("%env_asan_opts=", "env ASAN_OPTIONS=" + default_asan_opts_str)
4343
)
44+
config.substitutions.append(
45+
("%export_asan_opts=", "export ASAN_OPTIONS=" + default_asan_opts_str)
46+
)
4447

4548
# Setup source root.
4649
config.test_source_root = os.path.dirname(__file__)

compiler-rt/test/lit.common.cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,3 +1066,5 @@ def target_page_size():
10661066
# llvm.
10671067
config.substitutions.append(("%crt_src", config.compiler_rt_src_root))
10681068
config.substitutions.append(("%llvm_src", config.llvm_src_root))
1069+
1070+
config.substitutions.append(("%python", '"%s"' % (sys.executable)))

0 commit comments

Comments
 (0)