From d7ae348bc52edf6eab4f5520c4e83817306166c1 Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Mon, 26 May 2014 13:44:57 +0000 Subject: [PATCH] [ASan tests] Use ASAN_OPTIONS in a portable way git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209629 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/asan/TestCases/allocator_returns_null.cc | 20 +++++++++--------- test/asan/TestCases/asan-symbolize-sanity-test.cc | 2 +- test/asan/TestCases/atexit_stats.cc | 2 +- test/asan/TestCases/contiguous_container_crash.cc | 2 +- test/asan/TestCases/deep_call_stack.cc | 2 +- test/asan/TestCases/deep_stack_uaf.cc | 2 +- test/asan/TestCases/double-free.cc | 4 ++-- test/asan/TestCases/gc-test.cc | 4 ++-- test/asan/TestCases/heap-overflow.cc | 2 +- test/asan/TestCases/init-order-atexit.cc | 2 +- test/asan/TestCases/init-order-pthread-create.cc | 2 +- test/asan/TestCases/initialization-blacklist.cc | 6 +++--- test/asan/TestCases/initialization-bug.cc | 2 +- test/asan/TestCases/initialization-constexpr.cc | 8 ++++---- test/asan/TestCases/initialization-nobug.cc | 8 ++++---- test/asan/TestCases/invalid-free.cc | 4 ++-- test/asan/TestCases/log-path_test.cc | 8 ++++---- test/asan/TestCases/log_path_fork_test.cc.disabled | 2 +- test/asan/TestCases/malloc_context_size.cc | 10 ++++----- test/asan/TestCases/malloc_fill.cc | 4 ++-- test/asan/TestCases/max_redzone.cc | 4 ++-- test/asan/TestCases/memcmp_strict_test.cc | 4 ++-- test/asan/TestCases/mmap_limit_mb.cc | 8 ++++---- test/asan/TestCases/poison_partial.cc | 4 ++-- test/asan/TestCases/print_summary.cc | 2 +- test/asan/TestCases/printf-1.c | 4 ++-- test/asan/TestCases/printf-2.c | 6 +++--- test/asan/TestCases/printf-3.c | 4 ++-- test/asan/TestCases/printf-4.c | 4 ++-- test/asan/TestCases/printf-5.c | 6 +++--- test/asan/TestCases/sleep_before_dying.c | 2 +- test/asan/TestCases/stack-overflow.cc | 24 +++++++++++----------- test/asan/TestCases/stack-use-after-return.cc | 6 +++--- test/asan/TestCases/strip_path_prefix.c | 2 +- test/asan/TestCases/use-after-poison.cc | 2 +- test/asan/TestCases/use-after-scope.cc | 2 +- 36 files changed, 90 insertions(+), 90 deletions(-) diff --git a/test/asan/TestCases/allocator_returns_null.cc b/test/asan/TestCases/allocator_returns_null.cc index f3a535d23..59a053c3d 100644 --- a/test/asan/TestCases/allocator_returns_null.cc +++ b/test/asan/TestCases/allocator_returns_null.cc @@ -4,16 +4,16 @@ // // RUN: %clangxx_asan -O0 %s -o %t // RUN: not %run %t malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mCRASH -// RUN: ASAN_OPTIONS=allocator_may_return_null=0 not %run %t malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mCRASH -// RUN: ASAN_OPTIONS=allocator_may_return_null=1 %run %t malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mNULL -// RUN: ASAN_OPTIONS=allocator_may_return_null=0 not %run %t calloc 2>&1 | FileCheck %s --check-prefix=CHECK-cCRASH -// RUN: ASAN_OPTIONS=allocator_may_return_null=1 %run %t calloc 2>&1 | FileCheck %s --check-prefix=CHECK-cNULL -// RUN: ASAN_OPTIONS=allocator_may_return_null=0 not %run %t calloc-overflow 2>&1 | FileCheck %s --check-prefix=CHECK-coCRASH -// RUN: ASAN_OPTIONS=allocator_may_return_null=1 %run %t calloc-overflow 2>&1 | FileCheck %s --check-prefix=CHECK-coNULL -// RUN: ASAN_OPTIONS=allocator_may_return_null=0 not %run %t realloc 2>&1 | FileCheck %s --check-prefix=CHECK-rCRASH -// RUN: ASAN_OPTIONS=allocator_may_return_null=1 %run %t realloc 2>&1 | FileCheck %s --check-prefix=CHECK-rNULL -// RUN: ASAN_OPTIONS=allocator_may_return_null=0 not %run %t realloc-after-malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mrCRASH -// RUN: ASAN_OPTIONS=allocator_may_return_null=1 %run %t realloc-after-malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mrNULL +// RUN: env ASAN_OPTIONS=allocator_may_return_null=0 not %run %t malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mCRASH +// RUN: env ASAN_OPTIONS=allocator_may_return_null=1 %run %t malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mNULL +// RUN: env ASAN_OPTIONS=allocator_may_return_null=0 not %run %t calloc 2>&1 | FileCheck %s --check-prefix=CHECK-cCRASH +// RUN: env ASAN_OPTIONS=allocator_may_return_null=1 %run %t calloc 2>&1 | FileCheck %s --check-prefix=CHECK-cNULL +// RUN: env ASAN_OPTIONS=allocator_may_return_null=0 not %run %t calloc-overflow 2>&1 | FileCheck %s --check-prefix=CHECK-coCRASH +// RUN: env ASAN_OPTIONS=allocator_may_return_null=1 %run %t calloc-overflow 2>&1 | FileCheck %s --check-prefix=CHECK-coNULL +// RUN: env ASAN_OPTIONS=allocator_may_return_null=0 not %run %t realloc 2>&1 | FileCheck %s --check-prefix=CHECK-rCRASH +// RUN: env ASAN_OPTIONS=allocator_may_return_null=1 %run %t realloc 2>&1 | FileCheck %s --check-prefix=CHECK-rNULL +// RUN: env ASAN_OPTIONS=allocator_may_return_null=0 not %run %t realloc-after-malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mrCRASH +// RUN: env ASAN_OPTIONS=allocator_may_return_null=1 %run %t realloc-after-malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mrNULL #include #include diff --git a/test/asan/TestCases/asan-symbolize-sanity-test.cc b/test/asan/TestCases/asan-symbolize-sanity-test.cc index 077187836..d80f534a0 100644 --- a/test/asan/TestCases/asan-symbolize-sanity-test.cc +++ b/test/asan/TestCases/asan-symbolize-sanity-test.cc @@ -3,7 +3,7 @@ // RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %t-so.so // RUN: %clangxx_asan -O0 %s -ldl -o %t -// RUN: ASAN_OPTIONS=symbolize=0 not %run %t 2>&1 | %asan_symbolize | FileCheck %s +// RUN: env ASAN_OPTIONS=symbolize=0 not %run %t 2>&1 | %asan_symbolize | FileCheck %s #if !defined(SHARED_LIB) #include diff --git a/test/asan/TestCases/atexit_stats.cc b/test/asan/TestCases/atexit_stats.cc index 9273d1c52..b5a5fad92 100644 --- a/test/asan/TestCases/atexit_stats.cc +++ b/test/asan/TestCases/atexit_stats.cc @@ -1,6 +1,6 @@ // Make sure we report atexit stats. // RUN: %clangxx_asan -O3 %s -o %t -// RUN: ASAN_OPTIONS=atexit=1:print_stats=1 %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=atexit=1:print_stats=1 %run %t 2>&1 | FileCheck %s // // No atexit output on Android due to // https://code.google.com/p/address-sanitizer/issues/detail?id=263 diff --git a/test/asan/TestCases/contiguous_container_crash.cc b/test/asan/TestCases/contiguous_container_crash.cc index 9f4d55017..143ae9d8e 100644 --- a/test/asan/TestCases/contiguous_container_crash.cc +++ b/test/asan/TestCases/contiguous_container_crash.cc @@ -1,7 +1,7 @@ // RUN: %clangxx_asan -O %s -o %t // RUN: not %run %t crash 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s // RUN: not %run %t bad-bounds 2>&1 | FileCheck --check-prefix=CHECK-BAD %s -// RUN: ASAN_OPTIONS=detect_container_overflow=0 %run %t crash +// RUN: env ASAN_OPTIONS=detect_container_overflow=0 %run %t crash // // Test crash due to __sanitizer_annotate_contiguous_container. diff --git a/test/asan/TestCases/deep_call_stack.cc b/test/asan/TestCases/deep_call_stack.cc index 6716e0a6e..c30677571 100644 --- a/test/asan/TestCases/deep_call_stack.cc +++ b/test/asan/TestCases/deep_call_stack.cc @@ -3,7 +3,7 @@ // RUN: %clangxx_asan -O2 %s -o %t && \ // RUN: %run %t 2>&1 | FileCheck %s // Also check that use_sigaltstack+verbosity doesn't crash. -// RUN: ASAN_OPTIONS=verbosity=1:use_sigaltstack=1 %run %t | FileCheck %s +// RUN: env ASAN_OPTIONS=verbosity=1:use_sigaltstack=1 %run %t | FileCheck %s #include __attribute__((noinline)) diff --git a/test/asan/TestCases/deep_stack_uaf.cc b/test/asan/TestCases/deep_stack_uaf.cc index 42b9db25d..9ce27d5dd 100644 --- a/test/asan/TestCases/deep_stack_uaf.cc +++ b/test/asan/TestCases/deep_stack_uaf.cc @@ -1,7 +1,7 @@ // Check that we can store lots of stack frames if asked to. // RUN: %clangxx_asan -O0 %s -o %t 2>&1 -// RUN: ASAN_OPTIONS=malloc_context_size=120:redzone=512 not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=malloc_context_size=120:redzone=512 not %run %t 2>&1 | FileCheck %s #include #include diff --git a/test/asan/TestCases/double-free.cc b/test/asan/TestCases/double-free.cc index b530bfd81..6bbca24e5 100644 --- a/test/asan/TestCases/double-free.cc +++ b/test/asan/TestCases/double-free.cc @@ -2,8 +2,8 @@ // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=MALLOC-CTX // Also works if no malloc context is available. -// RUN: ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s #include #include diff --git a/test/asan/TestCases/gc-test.cc b/test/asan/TestCases/gc-test.cc index da8d018f3..b15e66810 100644 --- a/test/asan/TestCases/gc-test.cc +++ b/test/asan/TestCases/gc-test.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_asan %s -lpthread -o %t -// RUN: ASAN_OPTIONS=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 -// RUN: ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0 +// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 +// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0 #include #include diff --git a/test/asan/TestCases/heap-overflow.cc b/test/asan/TestCases/heap-overflow.cc index d5797dc91..70a120356 100644 --- a/test/asan/TestCases/heap-overflow.cc +++ b/test/asan/TestCases/heap-overflow.cc @@ -2,7 +2,7 @@ // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=print_stats=1 not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=print_stats=1 not %run %t 2>&1 | FileCheck %s // FIXME: Fix this test under GCC. // REQUIRES: Clang diff --git a/test/asan/TestCases/init-order-atexit.cc b/test/asan/TestCases/init-order-atexit.cc index c5c61c9d3..c4defaf15 100644 --- a/test/asan/TestCases/init-order-atexit.cc +++ b/test/asan/TestCases/init-order-atexit.cc @@ -5,7 +5,7 @@ // We do *not* want to report init-order bug in this case. // RUN: %clangxx_asan -O0 %s %p/Helpers/init-order-atexit-extra.cc -o %t -// RUN: ASAN_OPTIONS=strict_init_order=true not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=strict_init_order=true not %run %t 2>&1 | FileCheck %s #include #include diff --git a/test/asan/TestCases/init-order-pthread-create.cc b/test/asan/TestCases/init-order-pthread-create.cc index 21abebd60..e3334364e 100644 --- a/test/asan/TestCases/init-order-pthread-create.cc +++ b/test/asan/TestCases/init-order-pthread-create.cc @@ -2,7 +2,7 @@ // called. // RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -lpthread -o %t -// RUN: ASAN_OPTIONS=strict_init_order=true %run %t +// RUN: env ASAN_OPTIONS=strict_init_order=true %run %t #include #include diff --git a/test/asan/TestCases/initialization-blacklist.cc b/test/asan/TestCases/initialization-blacklist.cc index b6b459bdd..42c78fa03 100644 --- a/test/asan/TestCases/initialization-blacklist.cc +++ b/test/asan/TestCases/initialization-blacklist.cc @@ -4,17 +4,17 @@ // RUN: %p/Helpers/initialization-blacklist-extra2.cc \ // RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \ // RUN: -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-blacklist-extra.cc\ // RUN: %p/Helpers/initialization-blacklist-extra2.cc \ // RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \ // RUN: -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-blacklist-extra.cc\ // RUN: %p/Helpers/initialization-blacklist-extra2.cc \ // RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \ // RUN: -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // Function is defined in another TU. int readBadGlobal(); diff --git a/test/asan/TestCases/initialization-bug.cc b/test/asan/TestCases/initialization-bug.cc index 6179f745c..badc6d1d1 100644 --- a/test/asan/TestCases/initialization-bug.cc +++ b/test/asan/TestCases/initialization-bug.cc @@ -1,7 +1,7 @@ // Test to make sure basic initialization order errors are caught. // RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-bug-extra2.cc -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=check_initialization_order=true not %run %t 2>&1 | FileCheck %s // Do not test with optimization -- the error may be optimized away. diff --git a/test/asan/TestCases/initialization-constexpr.cc b/test/asan/TestCases/initialization-constexpr.cc index 3dbbc5e96..f96488863 100644 --- a/test/asan/TestCases/initialization-constexpr.cc +++ b/test/asan/TestCases/initialization-constexpr.cc @@ -6,16 +6,16 @@ // RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-constexpr-extra.cc\ // RUN: --std=c++11 -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-constexpr-extra.cc\ // RUN: --std=c++11 -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-constexpr-extra.cc\ // RUN: --std=c++11 -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-constexpr-extra.cc\ // RUN: --std=c++11 -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 class Integer { private: diff --git a/test/asan/TestCases/initialization-nobug.cc b/test/asan/TestCases/initialization-nobug.cc index 54abd453a..87c5dc85a 100644 --- a/test/asan/TestCases/initialization-nobug.cc +++ b/test/asan/TestCases/initialization-nobug.cc @@ -2,13 +2,13 @@ // order checking. If successful, this will just return 0. // RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-nobug-extra.cc -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-nobug-extra.cc -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-nobug-extra.cc -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-nobug-extra.cc -fsanitize=init-order -o %t -// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 +// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 // Simple access: // Make sure that accessing a global in the same TU is safe diff --git a/test/asan/TestCases/invalid-free.cc b/test/asan/TestCases/invalid-free.cc index a5c385d0a..fdfec73a6 100644 --- a/test/asan/TestCases/invalid-free.cc +++ b/test/asan/TestCases/invalid-free.cc @@ -2,8 +2,8 @@ // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=MALLOC-CTX // Also works if no malloc context is available. -// RUN: ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s #include #include diff --git a/test/asan/TestCases/log-path_test.cc b/test/asan/TestCases/log-path_test.cc index af1f53c5d..cac0c5fb3 100644 --- a/test/asan/TestCases/log-path_test.cc +++ b/test/asan/TestCases/log-path_test.cc @@ -6,21 +6,21 @@ // Good log_path. // RUN: rm -f %t.log.* -// RUN: ASAN_OPTIONS=log_path=%t.log not %run %t 2> %t.out +// RUN: env ASAN_OPTIONS=log_path=%t.log not %run %t 2> %t.out // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.* // Invalid log_path. -// RUN: ASAN_OPTIONS=log_path=/INVALID not %run %t 2> %t.out +// RUN: env ASAN_OPTIONS=log_path=/INVALID not %run %t 2> %t.out // RUN: FileCheck %s --check-prefix=CHECK-INVALID < %t.out // Too long log_path. -// RUN: ASAN_OPTIONS=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \ +// RUN: env ASAN_OPTIONS=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \ // RUN: not %run %t 2> %t.out // RUN: FileCheck %s --check-prefix=CHECK-LONG < %t.out // Run w/o errors should not produce any log. // RUN: rm -f %t.log.* -// RUN: ASAN_OPTIONS=log_path=%t.log %run %t ARG ARG ARG +// RUN: env ASAN_OPTIONS=log_path=%t.log %run %t ARG ARG ARG // RUN: not cat %t.log.* diff --git a/test/asan/TestCases/log_path_fork_test.cc.disabled b/test/asan/TestCases/log_path_fork_test.cc.disabled index 5de95fed4..cfe90dfb5 100644 --- a/test/asan/TestCases/log_path_fork_test.cc.disabled +++ b/test/asan/TestCases/log_path_fork_test.cc.disabled @@ -1,7 +1,7 @@ // RUN: %clangxx_asan %s -o %t // RUN: rm -f %t.log.* // Set verbosity to 1 so that the log files are opened prior to fork(). -// RUN: ASAN_OPTIONS="log_path=%t.log verbosity=1" not %run %t 2> %t.out +// RUN: env ASAN_OPTIONS="log_path=%t.log verbosity=1" not %run %t 2> %t.out // RUN: for f in %t.log.* ; do FileCheck %s < $f; done // RUN: [ `ls %t.log.* | wc -l` == 2 ] diff --git a/test/asan/TestCases/malloc_context_size.cc b/test/asan/TestCases/malloc_context_size.cc index 12f02fedc..9f7ba4055 100644 --- a/test/asan/TestCases/malloc_context_size.cc +++ b/test/asan/TestCases/malloc_context_size.cc @@ -1,9 +1,9 @@ // RUN: %clangxx_asan -O0 %s -o %t -// RUN: ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os -// RUN: ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os -// RUN: ASAN_OPTIONS=malloc_context_size=1:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os -// RUN: ASAN_OPTIONS=malloc_context_size=1:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os -// RUN: ASAN_OPTIONS=malloc_context_size=2 not %run %t 2>&1 | FileCheck %s --check-prefix=TWO +// RUN: env ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os +// RUN: env ASAN_OPTIONS=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os +// RUN: env ASAN_OPTIONS=malloc_context_size=1:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os +// RUN: env ASAN_OPTIONS=malloc_context_size=1:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os +// RUN: env ASAN_OPTIONS=malloc_context_size=2 not %run %t 2>&1 | FileCheck %s --check-prefix=TWO int main() { char *x = new char[20]; diff --git a/test/asan/TestCases/malloc_fill.cc b/test/asan/TestCases/malloc_fill.cc index cca8dba11..5c9268037 100644 --- a/test/asan/TestCases/malloc_fill.cc +++ b/test/asan/TestCases/malloc_fill.cc @@ -1,8 +1,8 @@ // Check that we fill malloc-ed memory correctly. // RUN: %clangxx_asan %s -o %t // RUN: %run %t | FileCheck %s -// RUN: ASAN_OPTIONS=max_malloc_fill_size=10:malloc_fill_byte=8 %run %t | FileCheck %s --check-prefix=CHECK-10-8 -// RUN: ASAN_OPTIONS=max_malloc_fill_size=20:malloc_fill_byte=171 %run %t | FileCheck %s --check-prefix=CHECK-20-ab +// RUN: env ASAN_OPTIONS=max_malloc_fill_size=10:malloc_fill_byte=8 %run %t | FileCheck %s --check-prefix=CHECK-10-8 +// RUN: env ASAN_OPTIONS=max_malloc_fill_size=20:malloc_fill_byte=171 %run %t | FileCheck %s --check-prefix=CHECK-20-ab #include int main(int argc, char **argv) { diff --git a/test/asan/TestCases/max_redzone.cc b/test/asan/TestCases/max_redzone.cc index a3beb7ab7..f2c0dee52 100644 --- a/test/asan/TestCases/max_redzone.cc +++ b/test/asan/TestCases/max_redzone.cc @@ -1,8 +1,8 @@ // Test max_redzone runtime option. -// RUN: %clangxx_asan -O0 %s -o %t && ASAN_OPTIONS=max_redzone=16 %run %t 0 2>&1 +// RUN: %clangxx_asan -O0 %s -o %t && env ASAN_OPTIONS=max_redzone=16 %run %t 0 2>&1 // RUN: %clangxx_asan -O0 %s -o %t && %run %t 1 2>&1 -// RUN: %clangxx_asan -O3 %s -o %t && ASAN_OPTIONS=max_redzone=16 %run %t 0 2>&1 +// RUN: %clangxx_asan -O3 %s -o %t && env ASAN_OPTIONS=max_redzone=16 %run %t 0 2>&1 // RUN: %clangxx_asan -O3 %s -o %t && %run %t 1 2>&1 #include diff --git a/test/asan/TestCases/memcmp_strict_test.cc b/test/asan/TestCases/memcmp_strict_test.cc index 1dcc57319..16b7673dd 100644 --- a/test/asan/TestCases/memcmp_strict_test.cc +++ b/test/asan/TestCases/memcmp_strict_test.cc @@ -1,5 +1,5 @@ -// RUN: %clangxx_asan -O0 %s -o %t && ASAN_OPTIONS=strict_memcmp=0 %run %t -// RUN: %clangxx_asan -O0 %s -o %t && ASAN_OPTIONS=strict_memcmp=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -o %t && env ASAN_OPTIONS=strict_memcmp=0 %run %t +// RUN: %clangxx_asan -O0 %s -o %t && env ASAN_OPTIONS=strict_memcmp=1 not %run %t 2>&1 | FileCheck %s // Default to strict_memcmp=1. // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s diff --git a/test/asan/TestCases/mmap_limit_mb.cc b/test/asan/TestCases/mmap_limit_mb.cc index f9772bd2f..5fc0295f7 100644 --- a/test/asan/TestCases/mmap_limit_mb.cc +++ b/test/asan/TestCases/mmap_limit_mb.cc @@ -3,10 +3,10 @@ // RUN: %clangxx_asan -O2 %s -o %t // RUN: %run %t 100 16 // RUN: %run %t 100 1000000 -// RUN: ASAN_OPTIONS=mmap_limit_mb=500 %run %t 50 16 -// RUN: ASAN_OPTIONS=mmap_limit_mb=500 %run %t 50 1000000 -// RUN: ASAN_OPTIONS=mmap_limit_mb=500 not %run %t 500 16 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=mmap_limit_mb=500 not %run %t 500 1000000 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=mmap_limit_mb=500 %run %t 50 16 +// RUN: env ASAN_OPTIONS=mmap_limit_mb=500 %run %t 50 1000000 +// RUN: env ASAN_OPTIONS=mmap_limit_mb=500 not %run %t 500 16 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=mmap_limit_mb=500 not %run %t 500 1000000 2>&1 | FileCheck %s #include #include diff --git a/test/asan/TestCases/poison_partial.cc b/test/asan/TestCases/poison_partial.cc index 320eeab5c..ce9c98b78 100644 --- a/test/asan/TestCases/poison_partial.cc +++ b/test/asan/TestCases/poison_partial.cc @@ -1,8 +1,8 @@ // RUN: %clangxx_asan -O0 %s -o %t // RUN: not %run %t 2>&1 | FileCheck %s // RUN: not %run %t heap 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=poison_partial=0 %run %t -// RUN: ASAN_OPTIONS=poison_partial=0 %run %t heap +// RUN: env ASAN_OPTIONS=poison_partial=0 %run %t +// RUN: env ASAN_OPTIONS=poison_partial=0 %run %t heap #include char g[21]; char *x; diff --git a/test/asan/TestCases/print_summary.cc b/test/asan/TestCases/print_summary.cc index a2f1257c9..79411c529 100644 --- a/test/asan/TestCases/print_summary.cc +++ b/test/asan/TestCases/print_summary.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_asan -O0 %s -o %t // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=YES -// RUN: ASAN_OPTIONS=print_summary=false not %run %t 2>&1 | FileCheck %s --check-prefix=NO +// RUN: env ASAN_OPTIONS=print_summary=false not %run %t 2>&1 | FileCheck %s --check-prefix=NO int main() { char *x = new char[20]; diff --git a/test/asan/TestCases/printf-1.c b/test/asan/TestCases/printf-1.c index 0f1c12517..dee00a5c9 100644 --- a/test/asan/TestCases/printf-1.c +++ b/test/asan/TestCases/printf-1.c @@ -1,6 +1,6 @@ // RUN: %clang_asan -O2 %s -o %t -// RUN: ASAN_OPTIONS=check_printf=1 %run %t 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=check_printf=0 %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=check_printf=1 %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS=check_printf=0 %run %t 2>&1 | FileCheck %s // RUN: %run %t 2>&1 | FileCheck %s #include diff --git a/test/asan/TestCases/printf-2.c b/test/asan/TestCases/printf-2.c index 5558ad852..f12c0b7a3 100644 --- a/test/asan/TestCases/printf-2.c +++ b/test/asan/TestCases/printf-2.c @@ -1,9 +1,9 @@ // RUN: %clang_asan -O2 %s -o %t // We need replace_str=0 and replace_intrin=0 to avoid reporting errors in // strlen() and memcpy() called by printf(). -// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s -// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=0 %run %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s -// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=0 %run %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s +// RUN: env ASAN_OPTIONS=replace_str=0:replace_intrin=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s #include #include diff --git a/test/asan/TestCases/printf-3.c b/test/asan/TestCases/printf-3.c index ee87f7b9e..387f6d54e 100644 --- a/test/asan/TestCases/printf-3.c +++ b/test/asan/TestCases/printf-3.c @@ -1,6 +1,6 @@ // RUN: %clang_asan -O2 %s -o %t -// RUN: ASAN_OPTIONS=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s -// RUN: ASAN_OPTIONS=check_printf=0 %run %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s +// RUN: env ASAN_OPTIONS=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=check_printf=0 %run %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s // RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s #include diff --git a/test/asan/TestCases/printf-4.c b/test/asan/TestCases/printf-4.c index 96ce63095..b219d6f8b 100644 --- a/test/asan/TestCases/printf-4.c +++ b/test/asan/TestCases/printf-4.c @@ -1,8 +1,8 @@ // RUN: %clang_asan -O2 %s -o %t // We need replace_str=0 and replace_intrin=0 to avoid reporting errors in // strlen() and memcpy() called by puts(). -// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s -// RUN: ASAN_OPTIONS=replace_str=0:replace_intrin=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=replace_str=0:replace_intrin=0:check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=replace_str=0:replace_intrin=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s #include int main() { diff --git a/test/asan/TestCases/printf-5.c b/test/asan/TestCases/printf-5.c index 7433ac094..5bb43cbbb 100644 --- a/test/asan/TestCases/printf-5.c +++ b/test/asan/TestCases/printf-5.c @@ -1,8 +1,8 @@ // RUN: %clang_asan -O2 %s -o %t // We need replace_intrin=0 to avoid reporting errors in memcpy. -// RUN: ASAN_OPTIONS=replace_intrin=0:check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s -// RUN: ASAN_OPTIONS=replace_intrin=0:check_printf=0 %run %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s -// RUN: ASAN_OPTIONS=replace_intrin=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=replace_intrin=0:check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s +// RUN: env ASAN_OPTIONS=replace_intrin=0:check_printf=0 %run %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s +// RUN: env ASAN_OPTIONS=replace_intrin=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s #include #include diff --git a/test/asan/TestCases/sleep_before_dying.c b/test/asan/TestCases/sleep_before_dying.c index aed4a7513..28ae0bf66 100644 --- a/test/asan/TestCases/sleep_before_dying.c +++ b/test/asan/TestCases/sleep_before_dying.c @@ -1,5 +1,5 @@ // RUN: %clang_asan -O2 %s -o %t -// RUN: ASAN_OPTIONS="sleep_before_dying=1" not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS="sleep_before_dying=1" not %run %t 2>&1 | FileCheck %s #include int main() { diff --git a/test/asan/TestCases/stack-overflow.cc b/test/asan/TestCases/stack-overflow.cc index cde086c0c..4861fd211 100644 --- a/test/asan/TestCases/stack-overflow.cc +++ b/test/asan/TestCases/stack-overflow.cc @@ -1,18 +1,18 @@ // Test ASan detection of stack-overflow condition. -// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DTHREAD -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTHREAD -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTHREAD -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTHREAD -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s // RUN: not %run %t 2>&1 | FileCheck %s #include diff --git a/test/asan/TestCases/stack-use-after-return.cc b/test/asan/TestCases/stack-use-after-return.cc index 6d30e545b..e31a63cfe 100644 --- a/test/asan/TestCases/stack-use-after-return.cc +++ b/test/asan/TestCases/stack-use-after-return.cc @@ -3,7 +3,7 @@ // RUN: %clangxx_asan -O1 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t +// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t // Regression test for a CHECK failure with small stack size and large frame. // RUN: %clangxx_asan -O3 %s -lpthread -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s // @@ -12,8 +12,8 @@ // // Test the max_uar_stack_size_log/min_uar_stack_size_log flag. // -// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:max_uar_stack_size_log=20:verbosity=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-20 %s -// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:min_uar_stack_size_log=24:max_uar_stack_size_log=24:verbosity=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-24 %s +// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:max_uar_stack_size_log=20:verbosity=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-20 %s +// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:min_uar_stack_size_log=24:max_uar_stack_size_log=24:verbosity=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-24 %s #include #include diff --git a/test/asan/TestCases/strip_path_prefix.c b/test/asan/TestCases/strip_path_prefix.c index 7db8245fd..4556e9031 100644 --- a/test/asan/TestCases/strip_path_prefix.c +++ b/test/asan/TestCases/strip_path_prefix.c @@ -1,5 +1,5 @@ // RUN: %clang_asan -O2 %s -o %t -// RUN: ASAN_OPTIONS="strip_path_prefix='/'" not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS="strip_path_prefix='/'" not %run %t 2>&1 | FileCheck %s #include int main() { diff --git a/test/asan/TestCases/use-after-poison.cc b/test/asan/TestCases/use-after-poison.cc index f117661ce..3b247ff53 100644 --- a/test/asan/TestCases/use-after-poison.cc +++ b/test/asan/TestCases/use-after-poison.cc @@ -2,7 +2,7 @@ // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s // // Check that we can disable it -// RUN: ASAN_OPTIONS=allow_user_poisoning=0 %run %t +// RUN: env ASAN_OPTIONS=allow_user_poisoning=0 %run %t #include diff --git a/test/asan/TestCases/use-after-scope.cc b/test/asan/TestCases/use-after-scope.cc index 4a561e0cc..49f756cf7 100644 --- a/test/asan/TestCases/use-after-scope.cc +++ b/test/asan/TestCases/use-after-scope.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \ // RUN: not %run %t 2>&1 | FileCheck %s -// RUN: ASAN_OPTIONS="detect_stack_use_after_return=1" not %run %t 2>&1 | FileCheck %s +// RUN: env ASAN_OPTIONS="detect_stack_use_after_return=1" not %run %t 2>&1 | FileCheck %s int main() { int *p = 0; -- 2.11.4.GIT