summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/msan/lit_tests/keep-going.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/msan/lit_tests/keep-going.cc')
-rw-r--r--compiler-rt/lib/msan/lit_tests/keep-going.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler-rt/lib/msan/lit_tests/keep-going.cc b/compiler-rt/lib/msan/lit_tests/keep-going.cc
new file mode 100644
index 00000000000..3cafa84b1c8
--- /dev/null
+++ b/compiler-rt/lib/msan/lit_tests/keep-going.cc
@@ -0,0 +1,30 @@
+// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %t >%t.out 2>&1
+// FileCheck %s <%t.out
+// RUN: %clangxx_msan -m64 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %t >%t.out 2>&1
+// FileCheck %s <%t.out
+// RUN: %clangxx_msan -m64 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %t >%t.out 2>&1
+// FileCheck %s <%t.out
+
+// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && not %t >%t.out 2>&1
+// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
+// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %t >%t.out 2>&1
+// FileCheck %s <%t.out
+// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %t >%t.out 2>&1
+// FileCheck --check-prefix=CHECK-KEEP-GOING %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.
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+ char *volatile x = (char*)malloc(5 * sizeof(char));
+ if (x[0])
+ exit(0);
+ fprintf(stderr, "Done\n");
+ // CHECK-NOT: Done
+ // CHECK-KEEP-GOING: Done
+ return 0;
+}
OpenPOWER on IntegriCloud