diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-08-26 19:29:07 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-08-26 19:29:07 +0000 |
commit | 966eba0585d506f0aa90ff8a5c77deb7473202f8 (patch) | |
tree | c624c0f86a79098e0be68d2056f4ab23e2a13d54 | |
parent | 31ebf03c09b6ae43bbb1350e9a36243027ef6403 (diff) | |
download | bcm5719-llvm-966eba0585d506f0aa90ff8a5c77deb7473202f8.tar.gz bcm5719-llvm-966eba0585d506f0aa90ff8a5c77deb7473202f8.zip |
[Sanitizer] Test churn: use %env_tool_opts in sanitizer_common lit tests.
This follows the approach we use in ASan and UBSan lit tests to setup
tool options in a portable way, and to provide a nice way to specify
testsuite-wide defaults.
llvm-svn: 246058
10 files changed, 29 insertions, 27 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/assert.cc b/compiler-rt/test/sanitizer_common/TestCases/Linux/assert.cc index 7f9b0a061da..5d58ea4f7e8 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/assert.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/assert.cc @@ -1,8 +1,8 @@ // Test the handle_abort option. // RUN: %clang %s -o %t // RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s -// RUN: %tool_options=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s -// RUN: %tool_options=handle_abort=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s +// RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s +// RUN: %env_tool_opts=handle_abort=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s // FIXME: implement in other sanitizers, not just asan. // XFAIL: msan // XFAIL: lsan diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/fpe.cc b/compiler-rt/test/sanitizer_common/TestCases/Linux/fpe.cc index 988899daf90..b4be500732b 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/fpe.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/fpe.cc @@ -1,8 +1,8 @@ // Test the handle_sigfpe option. // RUN: %clang %s -o %t // RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s -// RUN: %tool_options=handle_sigfpe=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s -// RUN: %tool_options=handle_sigfpe=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s +// RUN: %env_tool_opts=handle_sigfpe=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s +// RUN: %env_tool_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s // FIXME: implement in other sanitizers, not just asan. // XFAIL: msan // XFAIL: lsan diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc b/compiler-rt/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc index 225c44e25cd..d4a60a0d373 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc @@ -2,12 +2,12 @@ // RUN: %clangxx -O2 %s -o %t // // Run with limit should fail: -// RUN: %tool_options=hard_rss_limit_mb=100 not %run %t 2>&1 | FileCheck %s +// RUN: %env_tool_opts=hard_rss_limit_mb=100 not %run %t 2>&1 | FileCheck %s // This run uses getrusage: -// RUN: %tool_options=hard_rss_limit_mb=100:can_use_proc_maps_statm=0 not %run %t 2>&1 | FileCheck %s +// RUN: %env_tool_opts=hard_rss_limit_mb=100:can_use_proc_maps_statm=0 not %run %t 2>&1 | FileCheck %s // // Run w/o limit or with a large enough limit should pass: -// RUN: %tool_options=hard_rss_limit_mb=1000 %run %t +// RUN: %env_tool_opts=hard_rss_limit_mb=1000 %run %t // RUN: %run %t // // FIXME: make it work for other sanitizers. diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc b/compiler-rt/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc index 145cc5d0576..d329122ae7f 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc @@ -2,12 +2,12 @@ // RUN: %clangxx -O2 %s -o %t // // Run with limit should fail: -// RUN: %tool_options=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_1 -// RUN: %tool_options=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_0 +// RUN: %env_tool_opts=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_1 +// RUN: %env_tool_opts=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_0 // This run uses getrusage. We can only test getrusage when allocator_may_return_null=0 // because getrusage gives us max-rss, not current-rss. -// RUN: %tool_options=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=0:can_use_proc_maps_statm=0 not %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_0 +// RUN: %env_tool_opts=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=0:can_use_proc_maps_statm=0 not %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_0 // FIXME: make it work for other sanitizers. // XFAIL: lsan diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc b/compiler-rt/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc index 15c5c11c974..8744c3fd382 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc @@ -1,5 +1,5 @@ // RUN: %clangxx -g %s -o %t -// RUN: %tool_options=decorate_proc_maps=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%tool_name +// RUN: %env_tool_opts=decorate_proc_maps=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%tool_name // REQUIRES: stable-runtime #include <errno.h> #include <fcntl.h> diff --git a/compiler-rt/test/sanitizer_common/TestCases/options-help.cc b/compiler-rt/test/sanitizer_common/TestCases/options-help.cc index eaa04a494be..913377db70f 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/options-help.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/options-help.cc @@ -1,5 +1,5 @@ // RUN: %clangxx -O0 %s -o %t -// RUN: %tool_options=help=1 %run %t 2>&1 | FileCheck %s +// RUN: %env_tool_opts=help=1 %run %t 2>&1 | FileCheck %s int main() { } diff --git a/compiler-rt/test/sanitizer_common/TestCases/options-include.cc b/compiler-rt/test/sanitizer_common/TestCases/options-include.cc index 4c34c198404..1528b15b9e9 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/options-include.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/options-include.cc @@ -7,30 +7,30 @@ // RUN: cat %t.options1.txt // RUN: cat %t.options2.txt -// RUN: %tool_options="help=0:include='%t.options1.txt'" %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=help=0:include='"%t.options1.txt"' %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND <%t.out -// RUN: %tool_options="include='%t.options1.txt',help=0" %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include='"%t.options1.txt"',help=0 %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND <%t.out -// RUN: %tool_options="include='%t.options-not-found.txt',help=1" not %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include='"%t.options-not-found.txt"',help=1 not %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out // include_if_exists does not fail when the file is missing -// RUN: %tool_options="include_if_exists='%t.options-not-found.txt',help=1" %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.txt"',help=1 %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out // %b (binary basename substitution) -// RUN: %tool_options="include='%t.options.%b'" %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include='"%t.options.%b"' %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out -// RUN: %tool_options="include='%t.options-not-found.%b'" not %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include='"%t.options-not-found.%b"' not %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-NOT-FOUND < %t.out -// RUN: %tool_options="include_if_exists='%t.options.%b'" %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include_if_exists='"%t.options.%b"' %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out -// RUN: %tool_options="include_if_exists='%t.options-not-found.%b'" %run %t 2>&1 | tee %t.out +// RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.%b"' %run %t 2>&1 | tee %t.out // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND < %t.out diff --git a/compiler-rt/test/sanitizer_common/TestCases/options-invalid.cc b/compiler-rt/test/sanitizer_common/TestCases/options-invalid.cc index 3c261405c99..572c4912cfd 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/options-invalid.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/options-invalid.cc @@ -1,6 +1,6 @@ // RUN: %clangxx -O0 %s -o %t -// RUN: %tool_options=invalid_option_name=10,verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-V1 -// RUN: %tool_options=invalid_option_name=10 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-V0 +// RUN: %env_tool_opts=invalid_option_name=10,verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-V1 +// RUN: %env_tool_opts=invalid_option_name=10 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-V0 #include <stdio.h> diff --git a/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc b/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc index 1251f67b83c..9134a88dac1 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc @@ -1,7 +1,7 @@ -// RUN: %clangxx -O0 %s -o %t && %tool_options=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s -// RUN: %clangxx -O3 %s -o %t && %tool_options=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s -// RUN: %tool_options='stack_trace_format="frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM -// RUN: %tool_options=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE +// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s +// RUN: %clangxx -O3 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s +// RUN: %env_tool_opts=stack_trace_format='"frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM +// RUN: %env_tool_opts=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE #include <sanitizer/common_interface_defs.h> diff --git a/compiler-rt/test/sanitizer_common/lit.common.cfg b/compiler-rt/test/sanitizer_common/lit.common.cfg index f2d3fec6baa..cda8ef6a4ee 100644 --- a/compiler-rt/test/sanitizer_common/lit.common.cfg +++ b/compiler-rt/test/sanitizer_common/lit.common.cfg @@ -31,7 +31,9 @@ def build_invocation(compile_flags): config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) ) config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) ) config.substitutions.append( ("%tool_name", config.tool_name) ) -config.substitutions.append( ("%tool_options", tool_options) ) +default_tool_options_str = '' +config.substitutions.append( ('%env_tool_opts=', + 'env ' + tool_options + '=' + default_tool_options_str)) config.suffixes = ['.c', '.cc', '.cpp'] |