[compiler-rt] r246058 - [Sanitizer] Test churn: use %env_tool_opts in sanitizer_common lit tests.

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 12:29:07 PDT 2015


Author: samsonov
Date: Wed Aug 26 14:29:07 2015
New Revision: 246058

URL: http://llvm.org/viewvc/llvm-project?rev=246058&view=rev
Log:
[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.

Modified:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc
    compiler-rt/trunk/test/sanitizer_common/lit.common.cfg

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc Wed Aug 26 14:29:07 2015
@@ -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

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc Wed Aug 26 14:29:07 2015
@@ -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

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc Wed Aug 26 14:29:07 2015
@@ -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.

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc Wed Aug 26 14:29:07 2015
@@ -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

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc Wed Aug 26 14:29:07 2015
@@ -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>

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/options-help.cc Wed Aug 26 14:29:07 2015
@@ -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() {
 }

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/options-include.cc Wed Aug 26 14:29:07 2015
@@ -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
 
 

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/options-invalid.cc Wed Aug 26 14:29:07 2015
@@ -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>
 

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc Wed Aug 26 14:29:07 2015
@@ -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>
 

Modified: compiler-rt/trunk/test/sanitizer_common/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/lit.common.cfg?rev=246058&r1=246057&r2=246058&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/lit.common.cfg (original)
+++ compiler-rt/trunk/test/sanitizer_common/lit.common.cfg Wed Aug 26 14:29:07 2015
@@ -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']
 




More information about the llvm-commits mailing list