[compiler-rt] r245967 - [UBSan] Test churn: use the approach from r244839 and r245962 in UBSan lit tests.

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 12:01:44 PDT 2015


Author: samsonov
Date: Tue Aug 25 14:01:44 2015
New Revision: 245967

URL: http://llvm.org/viewvc/llvm-project?rev=245967&view=rev
Log:
[UBSan] Test churn: use the approach from r244839 and r245962 in UBSan lit tests.

Introduce %env_ubsan_opts= substitution instead of specifying
UBSAN_OPTIONS manually in the RUN-lines. This will come in handy
once we introduce some default UBSAN_OPTIONS for the whole testsuite
(for instance, make abort_on_error common option).

Modified:
    compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp
    compiler-rt/trunk/test/ubsan/TestCases/Integer/summary.cpp
    compiler-rt/trunk/test/ubsan/TestCases/Misc/bool.cpp
    compiler-rt/trunk/test/ubsan/TestCases/Misc/coverage-levels.cc
    compiler-rt/trunk/test/ubsan/TestCases/Misc/log-path_test.cc
    compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp
    compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Function/function.cpp
    compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp
    compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
    compiler-rt/trunk/test/ubsan/lit.common.cfg

Modified: compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp Tue Aug 25 14:01:44 2015
@@ -1,6 +1,6 @@
 // RUN: %clangxx -fsanitize=float-cast-overflow %s -o %t
 // RUN: %run %t _
-// RUN: env UBSAN_OPTIONS=print_summary=1:report_error_type=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0
+// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0
 // RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-1
 // RUN: %run %t 2 2>&1 | FileCheck %s --check-prefix=CHECK-2
 // RUN: %run %t 3 2>&1 | FileCheck %s --check-prefix=CHECK-3

Modified: compiler-rt/trunk/test/ubsan/TestCases/Integer/summary.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Integer/summary.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Integer/summary.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Integer/summary.cpp Tue Aug 25 14:01:44 2015
@@ -1,6 +1,6 @@
 // RUN: %clangxx -fsanitize=integer %s -o %t
 // RUN: %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: env UBSAN_OPTIONS=report_error_type=1 %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
+// RUN: %env_ubsan_opts=report_error_type=1 %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
 // REQUIRES: ubsan-asan
 
 #include <stdint.h>

Modified: compiler-rt/trunk/test/ubsan/TestCases/Misc/bool.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/bool.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/bool.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/bool.cpp Tue Aug 25 14:01:44 2015
@@ -1,6 +1,6 @@
 // RUN: %clangxx -fsanitize=bool %s -O3 -o %t
 // RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: env UBSAN_OPTIONS=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
+// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
 
 unsigned char NotABool = 123;
 

Modified: compiler-rt/trunk/test/ubsan/TestCases/Misc/coverage-levels.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/coverage-levels.cc?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/coverage-levels.cc (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/coverage-levels.cc Tue Aug 25 14:01:44 2015
@@ -4,18 +4,17 @@
 // REQUIRES: shell
 //
 // RUN: mkdir -p %T/coverage-levels
-// RUN: OPT=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels
 // RUN: %clangxx -fsanitize=shift                        -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func  %s -o %t
-// RUN: UBSAN_OPTIONS=$OPT %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
+// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
 // RUN: %clangxx -fsanitize=undefined                    -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func  %s -o %t
-// RUN: UBSAN_OPTIONS=$OPT %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
+// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
 
 // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=func  %s -o %t
-// RUN: UBSAN_OPTIONS=$OPT %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
+// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
 // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=bb  %s -o %t
-// RUN: UBSAN_OPTIONS=$OPT %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN
+// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN
 // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=edge  %s -o %t
-// RUN: UBSAN_OPTIONS=$OPT %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN
+// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN
 
 // Coverage is not yet implemented in TSan.
 // XFAIL: ubsan-tsan

Modified: compiler-rt/trunk/test/ubsan/TestCases/Misc/log-path_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/log-path_test.cc?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/log-path_test.cc (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/log-path_test.cc Tue Aug 25 14:01:44 2015
@@ -9,12 +9,12 @@
 
 // Good log_path.
 // RUN: rm -f %t.log.*
-// RUN: env UBSAN_OPTIONS=log_path=%t.log %run %t -4 2> %t.out
+// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t -4 2> %t.out
 // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
 
 // Run w/o errors should not produce any log.
 // RUN: rm -f %t.log.*
-// RUN: env UBSAN_OPTIONS=log_path=%t.log  %run %t 4
+// RUN: %env_ubsan_opts=log_path='"%t.log"'  %run %t 4
 // RUN: not cat %t.log.*
 
 // FIXME: log_path is not supported on Windows yet.

Modified: compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp Tue Aug 25 14:01:44 2015
@@ -1,6 +1,6 @@
 // RUN: %clangxx -fsanitize=return -g %s -O3 -o %t
 // RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: env UBSAN_OPTIONS=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%os-STACKTRACE
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%os-STACKTRACE
 
 // CHECK: missing_return.cpp:[[@LINE+1]]:5: runtime error: execution reached the end of a value-returning function without returning a value
 int f() {

Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Function/function.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Function/function.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Function/function.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Function/function.cpp Tue Aug 25 14:01:44 2015
@@ -1,7 +1,7 @@
 // RUN: %clangxx -fsanitize=function %s -O3 -g -o %t
 // RUN: %run %t 2>&1 | FileCheck %s
 // Verify that we can disable symbolization if needed:
-// RUN: UBSAN_OPTIONS=symbolize=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOSYM
+// RUN: %env_ubsan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOSYM
 
 // -fsanitize=function is unsupported on Darwin yet.
 // XFAIL: darwin

Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp Tue Aug 25 14:01:44 2015
@@ -11,7 +11,7 @@
 // RUN: %run %t f1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
 // RUN: %run %t n1 2>&1 | FileCheck %s --check-prefix=CHECK-NEW
 // RUN: %run %t u1 2>&1 | FileCheck %s --check-prefix=CHECK-UPCAST
-// RUN: env UBSAN_OPTIONS=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-%os-STACK-LOAD
+// RUN: %env_ubsan_opts=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-%os-STACK-LOAD
 
 // RUN: %clangxx -fsanitize=alignment -fno-sanitize-recover=alignment %s -O3 -o %t
 // RUN: not %run %t w1 2>&1 | FileCheck %s --check-prefix=CHECK-WILD

Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp Tue Aug 25 14:01:44 2015
@@ -1,28 +1,27 @@
 // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
-// RUN: export UBSAN_OPTIONS=print_stacktrace=1
 // RUN: %run %t rT && %run %t mT && %run %t fT && %run %t cT
 // RUN: %run %t rU && %run %t mU && %run %t fU && %run %t cU
 // RUN: %run %t rS && %run %t rV && %run %t oV
-// RUN: not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
-// RUN: not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
-// RUN: not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
-// RUN: not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
-// RUN: not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
-// RUN: not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
-// RUN: not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace
-// RUN: not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
 
 // RUN: (echo "vptr_check:S"; echo "vptr_check:T"; echo "vptr_check:U") > %t.supp
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t mS
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t fS
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t cS
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t mV
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t fV
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t cV
-// RUN: UBSAN_OPTIONS="suppressions='%t.supp'" %run %t oU
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mS
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t fS
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t cS
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mV
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t fV
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t cV
+// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t oU
 
 // RUN: echo "vptr_check:S" > %t.loc-supp
-// RUN: UBSAN_OPTIONS="suppressions='%t.loc-supp'" not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS
+// RUN: %env_ubsan_opts=suppressions='"%t.loc-supp"' not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS
 
 // REQUIRES: stable-runtime, cxxabi
 #include <new>

Modified: compiler-rt/trunk/test/ubsan/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/lit.common.cfg?rev=245967&r1=245966&r2=245967&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/lit.common.cfg (original)
+++ compiler-rt/trunk/test/ubsan/lit.common.cfg Tue Aug 25 14:01:44 2015
@@ -42,6 +42,10 @@ elif ubsan_lit_test_mode == "ThreadSanit
 else:
   lit_config.fatal("Unknown UBSan test mode: %r" % ubsan_lit_test_mode)
 
+# Substitution to setup UBSAN_OPTIONS in portable way.
+config.substitutions.append(('%env_ubsan_opts=',
+                             'env UBSAN_OPTIONS='))
+
 def build_invocation(compile_flags):
   return " " + " ".join([config.clang] + compile_flags) + " "
 




More information about the llvm-commits mailing list