1 // The for loop in the backticks below requires bash. 2 // REQUIRES: shell 3 // 4 // RUN: %clangxx_memprof %s -o %t 5 6 // Regular run. 7 // RUN: %run %t 2> %t.out 8 // RUN: FileCheck %s --check-prefix=CHECK-GOOD < %t.out 9 10 // Good log_path. 11 // RUN: rm -f %t.log.* 12 // RUN: %env_memprof_opts=log_path=%t.log %run %t 2> %t.out 13 // RUN: FileCheck %s --check-prefix=CHECK-GOOD < %t.log.* 14 15 // Invalid log_path. 16 // RUN: %env_memprof_opts=log_path=/dev/null/INVALID not %run %t 2> %t.out 17 // RUN: FileCheck %s --check-prefix=CHECK-INVALID < %t.out 18 19 // Too long log_path. 20 // RUN: %env_memprof_opts=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \ 21 // RUN: not %run %t 2> %t.out 22 // RUN: FileCheck %s --check-prefix=CHECK-LONG < %t.out 23 24 #include <stdlib.h> 25 #include <string.h> 26 int main(int argc, char **argv) { 27 char *x = (char *)malloc(10); 28 memset(x, 0, 10); 29 free(x); 30 return 0; 31 } 32 // CHECK-GOOD: Memory allocation stack id 33 // CHECK-INVALID: ERROR: Can't open file: /dev/null/INVALID 34 // CHECK-LONG: ERROR: Path is too long: 01234 35