From 04af72c5423eb5ff7c0deba2d08cb46d583bb9d4 Mon Sep 17 00:00:00 2001 From: Julian Lettner Date: Fri, 5 Feb 2021 21:31:22 -0800 Subject: [PATCH] [Sanitizer] Fix failing sanitizer tests The new pass manager was enabled by default [1]. The commit message states the following relevant differences: * The inliner works slightly differently * -O1 does some amount of inlining These tests are affected because they specify `-O1` and then check the reported stack trace. [1] https://reviews.llvm.org/D95380 Differential Revision: https://reviews.llvm.org/D96198 --- compiler-rt/test/tsan/blacklist2.cpp | 2 +- compiler-rt/test/tsan/free_race.c | 2 +- compiler-rt/test/tsan/longjmp3.cpp | 2 +- compiler-rt/test/tsan/longjmp4.cpp | 2 +- compiler-rt/test/tsan/race_on_heap.cpp | 2 +- compiler-rt/test/tsan/race_top_suppression.cpp | 2 +- compiler-rt/test/tsan/simple_stack.c | 6 +++--- compiler-rt/test/tsan/sleep_sync.cpp | 2 +- compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/compiler-rt/test/tsan/blacklist2.cpp b/compiler-rt/test/tsan/blacklist2.cpp index 4ad9f413ca0b..31a7bcac2b6b 100644 --- a/compiler-rt/test/tsan/blacklist2.cpp +++ b/compiler-rt/test/tsan/blacklist2.cpp @@ -3,7 +3,7 @@ // RUN: echo "fun:*Blacklisted_Thread2*" > %t.blacklist // RUN: echo "fun:*CallTouchGlobal*" >> %t.blacklist -// RUN: %clangxx_tsan -O1 %s -fsanitize-blacklist=%t.blacklist -o %t +// RUN: %clangxx_tsan %s -fsanitize-blacklist=%t.blacklist -o %t // RUN: %deflake %run %t 2>&1 | FileCheck %s #include "test.h" diff --git a/compiler-rt/test/tsan/free_race.c b/compiler-rt/test/tsan/free_race.c index d508552c9801..9209c12e22ae 100644 --- a/compiler-rt/test/tsan/free_race.c +++ b/compiler-rt/test/tsan/free_race.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t +// RUN: %clang_tsan %s -o %t // RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOZUPP // RUN: %env_tsan_opts=suppressions='%s.supp':print_suppressions=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-SUPP diff --git a/compiler-rt/test/tsan/longjmp3.cpp b/compiler-rt/test/tsan/longjmp3.cpp index 842cf264c977..af23a3c40209 100644 --- a/compiler-rt/test/tsan/longjmp3.cpp +++ b/compiler-rt/test/tsan/longjmp3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan %s -o %t && %deflake %run %t 2>&1 | FileCheck %s #include #include diff --git a/compiler-rt/test/tsan/longjmp4.cpp b/compiler-rt/test/tsan/longjmp4.cpp index 4c2fbf0c4028..d8650764ace7 100644 --- a/compiler-rt/test/tsan/longjmp4.cpp +++ b/compiler-rt/test/tsan/longjmp4.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan %s -o %t && %deflake %run %t 2>&1 | FileCheck %s #include #include diff --git a/compiler-rt/test/tsan/race_on_heap.cpp b/compiler-rt/test/tsan/race_on_heap.cpp index 83bf36fad5fc..9057e9fdc0c2 100644 --- a/compiler-rt/test/tsan/race_on_heap.cpp +++ b/compiler-rt/test/tsan/race_on_heap.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s +// RUN: %clangxx_tsan %s -o %t && %deflake %run %t | FileCheck %s #include #include #include diff --git a/compiler-rt/test/tsan/race_top_suppression.cpp b/compiler-rt/test/tsan/race_top_suppression.cpp index bd5c1bd5f445..eeb3ef802cf2 100644 --- a/compiler-rt/test/tsan/race_top_suppression.cpp +++ b/compiler-rt/test/tsan/race_top_suppression.cpp @@ -1,5 +1,5 @@ // RUN: echo "race_top:TopFunction" > %t.supp -// RUN: %clangxx_tsan -O1 %s -o %t +// RUN: %clangxx_tsan %s -o %t // RUN: %env_tsan_opts=suppressions='%t.supp' %run %t 2>&1 | FileCheck %s // RUN: rm %t.supp #include "test.h" diff --git a/compiler-rt/test/tsan/simple_stack.c b/compiler-rt/test/tsan/simple_stack.c index 71a3911b39be..e46ffaa7a046 100644 --- a/compiler-rt/test/tsan/simple_stack.c +++ b/compiler-rt/test/tsan/simple_stack.c @@ -46,14 +46,14 @@ int main() { return 0; } -// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan %s -o %t && %deflake %run %t 2>&1 | FileCheck %s // Also check that functions instrumentation can be configured by either driver // or legacy flags: -// RUN: %clangxx_tsan -O1 %s -o %t -fno-sanitize-thread-func-entry-exit && %deflake %run %t 2>&1 \ +// RUN: %clangxx_tsan %s -o %t -fno-sanitize-thread-func-entry-exit && %deflake %run %t 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FUNC-ENTRY-EXIT-OFF %s -// RUN: %clangxx_tsan -O1 %s -o %t -mllvm -tsan-instrument-func-entry-exit=0 && %deflake %run %t 2>&1 \ +// RUN: %clangxx_tsan %s -o %t -mllvm -tsan-instrument-func-entry-exit=0 && %deflake %run %t 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FUNC-ENTRY-EXIT-OFF %s // CHECK: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/sleep_sync.cpp b/compiler-rt/test/tsan/sleep_sync.cpp index b2c6a1220f42..0eee9b67edef 100644 --- a/compiler-rt/test/tsan/sleep_sync.cpp +++ b/compiler-rt/test/tsan/sleep_sync.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s +// RUN: %clangxx_tsan %s -o %t && %deflake %run %t | FileCheck %s #include "test.h" int X = 0; diff --git a/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp b/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp index fe8c8bae603d..6b63baa9e819 100644 --- a/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp +++ b/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsanitize=return %gmlt %s -O3 -o %t +// RUN: %clangxx -fsanitize=return %gmlt %s -o %t // RUN: not %run %t 2>&1 | FileCheck %s // RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-STACKTRACE // Error message does not exact what expected