brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · b265fec Raw
42 lines · cpp
1// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&12// FileCheck %s <%t.out3// RUN: %clangxx_msan -O0 %s -o %t && env MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&14// FileCheck %s <%t.out5// RUN: %clangxx_msan -O0 %s -o %t && env MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&16// FileCheck %s <%t.out7 8// Test behavior of -fsanitize-recover=memory and MSAN_OPTIONS=keep_going.9// -fsanitize-recover=memory provides the default value of keep_going flag; value10// of 1 can be overwritten by MSAN_OPTIONS, value of 0 can not.11 12// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && not %run %t >%t.out 2>&113// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out14// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && env MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&115// FileCheck %s <%t.out16// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && env MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&117// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out18// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && env MSAN_OPTIONS=halt_on_error=1 not %run %t >%t.out 2>&119// FileCheck %s <%t.out20// RUN: %clangxx_msan -fsanitize-recover=memory -O0 %s -o %t && env MSAN_OPTIONS=halt_on_error=0 not %run %t >%t.out 2>&121// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out22 23// Basic test of legacy -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going.24 25// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&126// FileCheck --check-prefix=CHECK-RECOVER %s <%t.out27// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && env MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&128// FileCheck %s <%t.out29 30#include <stdio.h>31#include <stdlib.h>32 33int main(int argc, char **argv) {34  char *volatile x = (char*)malloc(5 * sizeof(char));35  if (x[0])36    exit(0);37  fprintf(stderr, "Done\n");38  // CHECK-NOT: Done39  // CHECK-RECOVER: Done40  return 0;41}42