[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
This commit is contained in:
parent
31ebf03c09
commit
966eba0585
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
|
Loading…
Reference in New Issue