1*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
2*7c3d14c8STreehugger Robot // FileCheck %s <%t.out
3*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
4*7c3d14c8STreehugger Robot // FileCheck %s <%t.out
5*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
6*7c3d14c8STreehugger Robot // FileCheck %s <%t.out
7*7c3d14c8STreehugger Robot
8*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
9*7c3d14c8STreehugger Robot // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
10*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
11*7c3d14c8STreehugger Robot // FileCheck %s <%t.out
12*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
13*7c3d14c8STreehugger Robot // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
14*7c3d14c8STreehugger Robot // 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
15*7c3d14c8STreehugger Robot // FileCheck %s <%t.out
16*7c3d14c8STreehugger Robot // 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
17*7c3d14c8STreehugger Robot // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
18*7c3d14c8STreehugger Robot
19*7c3d14c8STreehugger Robot // Test behaviour of -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going.
20*7c3d14c8STreehugger Robot // -mllvm -msan-keep-going provides the default value of keep_going flag; value
21*7c3d14c8STreehugger Robot // of 1 can be overwritten by MSAN_OPTIONS, value of 0 can not.
22*7c3d14c8STreehugger Robot
23*7c3d14c8STreehugger Robot #include <stdio.h>
24*7c3d14c8STreehugger Robot #include <stdlib.h>
25*7c3d14c8STreehugger Robot
main(int argc,char ** argv)26*7c3d14c8STreehugger Robot int main(int argc, char **argv) {
27*7c3d14c8STreehugger Robot char *volatile x = (char*)malloc(5 * sizeof(char));
28*7c3d14c8STreehugger Robot if (x[0])
29*7c3d14c8STreehugger Robot exit(0);
30*7c3d14c8STreehugger Robot fprintf(stderr, "Done\n");
31*7c3d14c8STreehugger Robot // CHECK-NOT: Done
32*7c3d14c8STreehugger Robot // CHECK-KEEP-GOING: Done
33*7c3d14c8STreehugger Robot return 0;
34*7c3d14c8STreehugger Robot }
35