summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-04-18 20:56:56 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-04-18 20:56:56 +0000
commitcae98fc8f058788565d250d75d671efc21ae6916 (patch)
treef082557a471bfd094dc5dbc3841c34f055e1c66f
parent26b476502c9857c3a0935d4f12489d4affd9038e (diff)
downloadbcm5719-llvm-cae98fc8f058788565d250d75d671efc21ae6916.tar.gz
bcm5719-llvm-cae98fc8f058788565d250d75d671efc21ae6916.zip
Allow for setting of global platform-specific lsan options in the test suite
Reviewers: kubamracek, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32131 llvm-svn: 300592
-rw-r--r--compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c4
-rw-r--r--compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c2
-rw-r--r--compiler-rt/test/lsan/TestCases/Linux/use_tls_dynamic.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/Linux/use_tls_static.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/disabler.c2
-rw-r--r--compiler-rt/test/lsan/TestCases/disabler.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/do_leak_check_override.cc4
-rw-r--r--compiler-rt/test/lsan/TestCases/high_allocator_contention.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/ignore_object.c2
-rw-r--r--compiler-rt/test/lsan/TestCases/ignore_object_errors.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/large_allocation_leak.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc8
-rw-r--r--compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/link_turned_off.cc4
-rw-r--r--compiler-rt/test/lsan/TestCases/pointer_to_self.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/print_suppressions.cc8
-rw-r--r--compiler-rt/test/lsan/TestCases/recoverable_leak_check.cc4
-rw-r--r--compiler-rt/test/lsan/TestCases/register_root_region.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/stale_stack_leak.cc4
-rw-r--r--compiler-rt/test/lsan/TestCases/suppressions_default.cc2
-rw-r--r--compiler-rt/test/lsan/TestCases/suppressions_file.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/swapcontext.cc4
-rw-r--r--compiler-rt/test/lsan/TestCases/use_after_return.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/use_globals_initialized.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc4
-rw-r--r--compiler-rt/test/lsan/TestCases/use_registers.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/use_stacks.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc6
-rw-r--r--compiler-rt/test/lsan/TestCases/use_unaligned.cc4
-rw-r--r--compiler-rt/test/lsan/lit.common.cfg8
33 files changed, 78 insertions, 70 deletions
diff --git a/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c b/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
index 6da75956345..cf080e4dd75 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
+++ b/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
@@ -5,8 +5,8 @@
// makes its best effort.
// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0"
// RUN: %clang_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:use_tls=1 %run %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:use_tls=0 not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:use_tls=1 %run %t
+// RUN: %env_lsan_opts=$LSAN_BASE:use_tls=0 not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <pthread.h>
diff --git a/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c b/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c
index 4a3a7ac14c3..52819bb9fcc 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c
+++ b/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c
@@ -1,7 +1,7 @@
// Regression test. Disabler should not depend on TSD validity.
// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=1:use_ld_allocations=0"
// RUN: %clang_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t
#include <assert.h>
#include <pthread.h>
diff --git a/compiler-rt/test/lsan/TestCases/Linux/use_tls_dynamic.cc b/compiler-rt/test/lsan/TestCases/Linux/use_tls_dynamic.cc
index 6af82d59e09..c81bcaed25a 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/use_tls_dynamic.cc
+++ b/compiler-rt/test/lsan/TestCases/Linux/use_tls_dynamic.cc
@@ -2,9 +2,9 @@
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0:use_ld_allocations=0"
// RUN: %clangxx %s -DBUILD_DSO -fPIC -shared -o %t-so.so
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
// UNSUPPORTED: i386-linux,i686-linux,arm
#ifndef BUILD_DSO
diff --git a/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc b/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc
index f075d035a3e..947a4ce243e 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc
+++ b/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc
@@ -1,9 +1,9 @@
// Test that dynamically allocated thread-specific storage is included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <assert.h>
#include <pthread.h>
diff --git a/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc b/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc
index d97abab41f0..8f5afc49aea 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc
+++ b/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc
@@ -1,9 +1,9 @@
// Test that statically allocated thread-specific storage is included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <assert.h>
#include <pthread.h>
diff --git a/compiler-rt/test/lsan/TestCases/Linux/use_tls_static.cc b/compiler-rt/test/lsan/TestCases/Linux/use_tls_static.cc
index be34a3abf30..e56f5e13af2 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/use_tls_static.cc
+++ b/compiler-rt/test/lsan/TestCases/Linux/use_tls_static.cc
@@ -1,9 +1,9 @@
// Test that statically allocated TLS space is included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/disabler.c b/compiler-rt/test/lsan/TestCases/disabler.c
index 1c4529df4f8..f8b7f0da1ba 100644
--- a/compiler-rt/test/lsan/TestCases/disabler.c
+++ b/compiler-rt/test/lsan/TestCases/disabler.c
@@ -1,7 +1,7 @@
// Test for __lsan_disable() / __lsan_enable().
// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0"
// RUN: %clang_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/disabler.cc b/compiler-rt/test/lsan/TestCases/disabler.cc
index 95e58f457cc..feabc36fab3 100644
--- a/compiler-rt/test/lsan/TestCases/disabler.cc
+++ b/compiler-rt/test/lsan/TestCases/disabler.cc
@@ -1,7 +1,7 @@
// Test for ScopedDisabler.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/do_leak_check_override.cc b/compiler-rt/test/lsan/TestCases/do_leak_check_override.cc
index 3d191f861d0..bffcf6ef66a 100644
--- a/compiler-rt/test/lsan/TestCases/do_leak_check_override.cc
+++ b/compiler-rt/test/lsan/TestCases/do_leak_check_override.cc
@@ -3,8 +3,8 @@
// "normal" mode (LSan runs in "strict" mode by default).
// RUN: LSAN_BASE="detect_leaks=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck --check-prefix=CHECK-strict %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck --check-prefix=CHECK-normal %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck --check-prefix=CHECK-strict %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck --check-prefix=CHECK-normal %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/high_allocator_contention.cc b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cc
index 322e61bde8d..8d8f9879bfa 100644
--- a/compiler-rt/test/lsan/TestCases/high_allocator_contention.cc
+++ b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cc
@@ -2,7 +2,7 @@
// Usage: ./a.out number_of_threads total_number_of_allocations
// RUN: LSAN_BASE="detect_leaks=1:use_ld_allocations=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t 5 1000000 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t 5 1000000 2>&1
#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/ignore_object.c b/compiler-rt/test/lsan/TestCases/ignore_object.c
index 2aa4f14e291..53dea75947b 100644
--- a/compiler-rt/test/lsan/TestCases/ignore_object.c
+++ b/compiler-rt/test/lsan/TestCases/ignore_object.c
@@ -1,7 +1,7 @@
// Test for __lsan_ignore_object().
// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0"
// RUN: %clang_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/ignore_object_errors.cc b/compiler-rt/test/lsan/TestCases/ignore_object_errors.cc
index 41603274a30..76cd3bbf34f 100644
--- a/compiler-rt/test/lsan/TestCases/ignore_object_errors.cc
+++ b/compiler-rt/test/lsan/TestCases/ignore_object_errors.cc
@@ -1,6 +1,6 @@
// Test for incorrect use of __lsan_ignore_object().
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/large_allocation_leak.cc b/compiler-rt/test/lsan/TestCases/large_allocation_leak.cc
index c3da932a41a..6bf593be13a 100644
--- a/compiler-rt/test/lsan/TestCases/large_allocation_leak.cc
+++ b/compiler-rt/test/lsan/TestCases/large_allocation_leak.cc
@@ -1,7 +1,7 @@
// Test that LargeMmapAllocator's chunks aren't reachable via some internal data structure.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
// For 32 bit LSan it's pretty likely that large chunks are "reachable" from some
// internal data structures (e.g. Glibc global data).
diff --git a/compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc b/compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc
index 5659b396894..2e00cfb12fb 100644
--- a/compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc
+++ b/compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc
@@ -1,10 +1,10 @@
// Test for the leak_check_at_exit flag.
// RUN: LSAN_BASE="detect_leaks=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"leak_check_at_exit=0" not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"leak_check_at_exit=0" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do
+// RUN: %env_lsan_opts=$LSAN_BASE:"leak_check_at_exit=0" not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
+// RUN: %env_lsan_opts=$LSAN_BASE:"leak_check_at_exit=0" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cc b/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cc
index ca818e1e269..94084dcb50f 100644
--- a/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cc
+++ b/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cc
@@ -1,7 +1,7 @@
// Regression test for http://llvm.org/bugs/show_bug.cgi?id=21621
// This test relies on timing between threads, so any failures will be flaky.
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS="log_pointers=1:log_threads=1" %run %t
+// RUN: %env_lsan_opts="log_pointers=1:log_threads=1" %run %t
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
diff --git a/compiler-rt/test/lsan/TestCases/link_turned_off.cc b/compiler-rt/test/lsan/TestCases/link_turned_off.cc
index a425a6c2da3..da848bbc327 100644
--- a/compiler-rt/test/lsan/TestCases/link_turned_off.cc
+++ b/compiler-rt/test/lsan/TestCases/link_turned_off.cc
@@ -1,8 +1,8 @@
// Test for disabling LSan at link-time.
// RUN: LSAN_BASE="detect_leaks=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
#include <sanitizer/lsan_interface.h>
diff --git a/compiler-rt/test/lsan/TestCases/pointer_to_self.cc b/compiler-rt/test/lsan/TestCases/pointer_to_self.cc
index ea1208dcfa7..4f34d8a8f1e 100644
--- a/compiler-rt/test/lsan/TestCases/pointer_to_self.cc
+++ b/compiler-rt/test/lsan/TestCases/pointer_to_self.cc
@@ -2,7 +2,7 @@
// object is indirectly leaked. Only external pointers count.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/print_suppressions.cc b/compiler-rt/test/lsan/TestCases/print_suppressions.cc
index 1a252e44272..0f914724456 100644
--- a/compiler-rt/test/lsan/TestCases/print_suppressions.cc
+++ b/compiler-rt/test/lsan/TestCases/print_suppressions.cc
@@ -2,10 +2,10 @@
// matched. Default is print_suppressions=true.
// RUN: LSAN_BASE="detect_leaks=1:use_registers=0:use_stacks=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: LSAN_OPTIONS=$LSAN_BASE:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-print
+// RUN: %env_lsan_opts=$LSAN_BASE:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
+// RUN: %env_lsan_opts=$LSAN_BASE:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-print
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/recoverable_leak_check.cc b/compiler-rt/test/lsan/TestCases/recoverable_leak_check.cc
index 04686a561d7..be10a49dc92 100644
--- a/compiler-rt/test/lsan/TestCases/recoverable_leak_check.cc
+++ b/compiler-rt/test/lsan/TestCases/recoverable_leak_check.cc
@@ -1,8 +1,8 @@
// Test for on-demand leak checking.
// RUN: LSAN_BASE="detect_leaks=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdio.h>
diff --git a/compiler-rt/test/lsan/TestCases/register_root_region.cc b/compiler-rt/test/lsan/TestCases/register_root_region.cc
index a63b0cc62cd..6e3c8c1ce0c 100644
--- a/compiler-rt/test/lsan/TestCases/register_root_region.cc
+++ b/compiler-rt/test/lsan/TestCases/register_root_region.cc
@@ -1,9 +1,9 @@
// Test for __lsan_(un)register_root_region().
// RUN: LSAN_BASE="detect_leaks=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:use_root_regions=0 not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:use_root_regions=0 not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdio.h>
diff --git a/compiler-rt/test/lsan/TestCases/stale_stack_leak.cc b/compiler-rt/test/lsan/TestCases/stale_stack_leak.cc
index 8f7ab9c1c0f..0b33f26a4f3 100644
--- a/compiler-rt/test/lsan/TestCases/stale_stack_leak.cc
+++ b/compiler-rt/test/lsan/TestCases/stale_stack_leak.cc
@@ -1,8 +1,8 @@
// Test that out-of-scope local variables are ignored by LSan.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_registers=0:use_stacks=1"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE":exitcode=0" %run %t 2>&1 | FileCheck --check-prefix=CHECK-sanity %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE":exitcode=0" %run %t 2>&1 | FileCheck --check-prefix=CHECK-sanity %s
//
// x86 passes parameters through stack that may lead to false negatives
// UNSUPPORTED: x86
diff --git a/compiler-rt/test/lsan/TestCases/suppressions_default.cc b/compiler-rt/test/lsan/TestCases/suppressions_default.cc
index 6c0364e62c7..da240f200ba 100644
--- a/compiler-rt/test/lsan/TestCases/suppressions_default.cc
+++ b/compiler-rt/test/lsan/TestCases/suppressions_default.cc
@@ -1,6 +1,6 @@
// RUN: LSAN_BASE="detect_leaks=1:use_registers=0:use_stacks=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/suppressions_file.cc b/compiler-rt/test/lsan/TestCases/suppressions_file.cc
index 1d8a06474d6..a14afc4d566 100644
--- a/compiler-rt/test/lsan/TestCases/suppressions_file.cc
+++ b/compiler-rt/test/lsan/TestCases/suppressions_file.cc
@@ -3,13 +3,13 @@
// RUN: rm -f %t.supp
// RUN: touch %t.supp
-// RUN: LSAN_OPTIONS="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s --check-prefix=NOSUPP
+// RUN: %env_lsan_opts="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s --check-prefix=NOSUPP
// RUN: echo "leak:*LSanTestLeakingFunc*" > %t.supp
-// RUN: LSAN_OPTIONS="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s
// RUN: echo "leak:%t" > %t.supp
-// RUN: LSAN_OPTIONS="$LSAN_BASE:suppressions='%t.supp':symbolize=false" %run %t
+// RUN: %env_lsan_opts="$LSAN_BASE:suppressions='%t.supp':symbolize=false" %run %t
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/swapcontext.cc b/compiler-rt/test/lsan/TestCases/swapcontext.cc
index f990526cf66..b019067aaca 100644
--- a/compiler-rt/test/lsan/TestCases/swapcontext.cc
+++ b/compiler-rt/test/lsan/TestCases/swapcontext.cc
@@ -3,8 +3,8 @@
// RUN: %clangxx_lsan %s -o %t
// RUN: LSAN_BASE="detect_leaks=1"
-// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t 2>&1
-// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
// UNSUPPORTED: arm
#include <stdio.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_after_return.cc b/compiler-rt/test/lsan/TestCases/use_after_return.cc
index 413775276b1..6c00639c017 100644
--- a/compiler-rt/test/lsan/TestCases/use_after_return.cc
+++ b/compiler-rt/test/lsan/TestCases/use_after_return.cc
@@ -2,9 +2,9 @@
// in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_registers=0"
// RUN: %clangxx_lsan %s -O2 -o %t
-// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 LSAN_OPTIONS=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
-// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 LSAN_OPTIONS="" %run %t 2>&1
+// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
+// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
+// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts="" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_globals_initialized.cc b/compiler-rt/test/lsan/TestCases/use_globals_initialized.cc
index 996052d6e83..07557ee8b1e 100644
--- a/compiler-rt/test/lsan/TestCases/use_globals_initialized.cc
+++ b/compiler-rt/test/lsan/TestCases/use_globals_initialized.cc
@@ -1,9 +1,9 @@
// Test that initialized globals are included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc b/compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc
index 25ccacc7eff..f42608662d8 100644
--- a/compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc
+++ b/compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc
@@ -1,9 +1,9 @@
// Test that uninitialized globals are included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc b/compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc
index d9ef16a4e1d..164b0cf67bc 100644
--- a/compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc
+++ b/compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc
@@ -2,8 +2,8 @@
// REQUIRES: asan
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_poisoned=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_poisoned=1" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_poisoned=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_poisoned=1" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_registers.cc b/compiler-rt/test/lsan/TestCases/use_registers.cc
index 2fe13318efc..fe552e62868 100644
--- a/compiler-rt/test/lsan/TestCases/use_registers.cc
+++ b/compiler-rt/test/lsan/TestCases/use_registers.cc
@@ -1,9 +1,9 @@
// Test that registers of running threads are included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0"
// RUN: %clangxx_lsan -pthread %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_registers=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_registers=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_registers=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_registers=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <assert.h>
#include <pthread.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_stacks.cc b/compiler-rt/test/lsan/TestCases/use_stacks.cc
index 95a01003b0c..656a78a7945 100644
--- a/compiler-rt/test/lsan/TestCases/use_stacks.cc
+++ b/compiler-rt/test/lsan/TestCases/use_stacks.cc
@@ -1,9 +1,9 @@
// Test that stack of main thread is included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc b/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc
index 310171feb03..c0549b22eb2 100644
--- a/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc
+++ b/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc
@@ -1,9 +1,9 @@
// Test that stacks of non-main threads are included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_registers=0"
// RUN: %clangxx_lsan -pthread %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
-// RUN: LSAN_OPTIONS="" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
+// RUN: %env_lsan_opts="" %run %t 2>&1
#include <assert.h>
#include <pthread.h>
diff --git a/compiler-rt/test/lsan/TestCases/use_unaligned.cc b/compiler-rt/test/lsan/TestCases/use_unaligned.cc
index 1179c15b73b..1d680a51bb1 100644
--- a/compiler-rt/test/lsan/TestCases/use_unaligned.cc
+++ b/compiler-rt/test/lsan/TestCases/use_unaligned.cc
@@ -1,8 +1,8 @@
// Test that unaligned pointers are detected correctly.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_unaligned=0" not %run %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_unaligned=1" %run %t 2>&1
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_unaligned=0" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_lsan_opts=$LSAN_BASE:"use_unaligned=1" %run %t 2>&1
#include <stdio.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/lsan/lit.common.cfg b/compiler-rt/test/lsan/lit.common.cfg
index b90c7ef4860..3de341783ed 100644
--- a/compiler-rt/test/lsan/lit.common.cfg
+++ b/compiler-rt/test/lsan/lit.common.cfg
@@ -32,6 +32,14 @@ else:
lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode)
config.name += config.name_suffix
+# Platform-specific default LSAN_OPTIONS for lit tests.
+default_lsan_opts = ''
+if default_lsan_opts:
+ config.environment['LSAN_OPTIONS'] = default_lsan_opts
+ default_lsan_opts += ':'
+config.substitutions.append(('%env_lsan_opts=',
+ 'env LSAN_OPTIONS=' + default_lsan_opts))
+
if lit.util.which('strace'):
config.available_features.add('strace')
OpenPOWER on IntegriCloud