From 5d387286d00c2d4b46510dcb9b76b9a5c80d5a02 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 7 Nov 2016 21:02:56 +0000 Subject: [PATCH] Use -fsanitize-recover instead of -mllvm -msan-keep-going: tests. Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: unit tests. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26355 Patch by Aleksey Shlyapnikov. llvm-svn: 286149 --- compiler-rt/test/msan/print_stats.cc | 18 ++++++------- .../msan/{keep-going-dso.cc => recover-dso.cc} | 30 ++++++++++++--------- .../test/msan/{keep-going.cc => recover.cc} | 31 +++++++++++++--------- 3 files changed, 46 insertions(+), 33 deletions(-) rename compiler-rt/test/msan/{keep-going-dso.cc => recover-dso.cc} (50%) rename compiler-rt/test/msan/{keep-going.cc => recover.cc} (53%) diff --git a/compiler-rt/test/msan/print_stats.cc b/compiler-rt/test/msan/print_stats.cc index 39af504..5b46d4e 100644 --- a/compiler-rt/test/msan/print_stats.cc +++ b/compiler-rt/test/msan/print_stats.cc @@ -1,22 +1,22 @@ // RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -g %s -o %t // RUN: %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-NOSTATS %s // RUN: MSAN_OPTIONS=print_stats=1 %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-NOSTATS %s // RUN: MSAN_OPTIONS=print_stats=1,atexit=1 %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-STATS %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-STATS %s // RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -g -DPOSITIVE=1 %s -o %t // RUN: not %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-NOSTATS %s // RUN: MSAN_OPTIONS=print_stats=1 not %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-STATS %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-STATS %s -// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -g -DPOSITIVE=1 -mllvm -msan-keep-going=1 %s -o %t +// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -fsanitize-recover=memory -g -DPOSITIVE=1 %s -o %t // RUN: not %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS --check-prefix=CHECK-KEEPGOING %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-NOSTATS,CHECK-RECOVER %s // RUN: MSAN_OPTIONS=print_stats=1 not %run %t 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-STATS --check-prefix=CHECK-KEEPGOING %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-STATS,CHECK-RECOVER %s #include int main(int argc, char **argv) { @@ -42,4 +42,4 @@ int main(int argc, char **argv) { // CHECK-NOSTATS-NOT: Unique origin histories: // CHECK-NOSTATS-NOT: History depot allocated bytes: -// CHECK-KEEPGOING: MemorySanitizer: 1 warnings reported. +// CHECK-RECOVER: MemorySanitizer: 1 warnings reported. diff --git a/compiler-rt/test/msan/keep-going-dso.cc b/compiler-rt/test/msan/recover-dso.cc similarity index 50% rename from compiler-rt/test/msan/keep-going-dso.cc rename to compiler-rt/test/msan/recover-dso.cc index f32a513..2f42256 100644 --- a/compiler-rt/test/msan/keep-going-dso.cc +++ b/compiler-rt/test/msan/recover-dso.cc @@ -1,22 +1,28 @@ // RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1 // FileCheck %s <%t.out // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1 -// FileCheck %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out - -// Test how -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going affect reports +// Test how -fsanitize-recover=memory and MSAN_OPTIONS=keep_going affect reports // from interceptors. -// -mllvm -msan-keep-going provides the default value of keep_going flag, but is +// -fsanitize-recover=memory provides the default value of keep_going flag, but is // always overwritten by MSAN_OPTIONS +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1 +// FileCheck %s <%t.out +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out + +// Test how legacy -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going affect +// reports from interceptors. + +// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out + #include #include #include @@ -28,6 +34,6 @@ int main(int argc, char **argv) { exit(0); fprintf(stderr, "Done\n"); // CHECK-NOT: Done - // CHECK-KEEP-GOING: Done + // CHECK-RECOVER: Done return 0; } diff --git a/compiler-rt/test/msan/keep-going.cc b/compiler-rt/test/msan/recover.cc similarity index 53% rename from compiler-rt/test/msan/keep-going.cc rename to compiler-rt/test/msan/recover.cc index 5772975..cb9916e 100644 --- a/compiler-rt/test/msan/keep-going.cc +++ b/compiler-rt/test/msan/recover.cc @@ -5,20 +5,27 @@ // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1 // FileCheck %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1 +// Test behavior of -fsanitize-recover=memory and MSAN_OPTIONS=keep_going. +// -fsanitize-recover=memory provides the default value of keep_going flag; value +// of 1 can be overwritten by MSAN_OPTIONS, value of 0 can not. + +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1 // FileCheck %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=1 not %run %t >%t.out 2>&1 +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=1 not %run %t >%t.out 2>&1 // FileCheck %s <%t.out -// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=0 not %run %t >%t.out 2>&1 -// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out +// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=0 not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out -// Test behaviour of -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going. -// -mllvm -msan-keep-going provides the default value of keep_going flag; value -// of 1 can be overwritten by MSAN_OPTIONS, value of 0 can not. +// Basic test of legacy -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going. + +// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1 +// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out +// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1 +// FileCheck %s <%t.out #include #include @@ -29,6 +36,6 @@ int main(int argc, char **argv) { exit(0); fprintf(stderr, "Done\n"); // CHECK-NOT: Done - // CHECK-KEEP-GOING: Done + // CHECK-RECOVER: Done return 0; } -- 2.7.4