xref: /aosp_15_r20/external/compiler-rt/test/asan/TestCases/verbose-log-path_test.cc (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // RUN: %clangxx_asan %s -o %T/verbose-log-path_test-binary
2*7c3d14c8STreehugger Robot 
3*7c3d14c8STreehugger Robot // The glob below requires bash.
4*7c3d14c8STreehugger Robot // REQUIRES: shell
5*7c3d14c8STreehugger Robot 
6*7c3d14c8STreehugger Robot // Good log_path.
7*7c3d14c8STreehugger Robot // RUN: rm -f %T/asan.log.*
8*7c3d14c8STreehugger Robot // RUN: %env_asan_opts=log_path=%T/asan.log:log_exe_name=1 not %run %T/verbose-log-path_test-binary 2> %t.out
9*7c3d14c8STreehugger Robot // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %T/asan.log.verbose-log-path_test-binary.*
10*7c3d14c8STreehugger Robot 
11*7c3d14c8STreehugger Robot // FIXME: only FreeBSD and Linux have verbose log paths now.
12*7c3d14c8STreehugger Robot // XFAIL: win32,android
13*7c3d14c8STreehugger Robot 
14*7c3d14c8STreehugger Robot #include <stdlib.h>
15*7c3d14c8STreehugger Robot #include <string.h>
main(int argc,char ** argv)16*7c3d14c8STreehugger Robot int main(int argc, char **argv) {
17*7c3d14c8STreehugger Robot   if (argc > 2) return 0;
18*7c3d14c8STreehugger Robot   char *x = (char*)malloc(10);
19*7c3d14c8STreehugger Robot   memset(x, 0, 10);
20*7c3d14c8STreehugger Robot   int res = x[argc * 10];  // BOOOM
21*7c3d14c8STreehugger Robot   free(x);
22*7c3d14c8STreehugger Robot   return res;
23*7c3d14c8STreehugger Robot }
24*7c3d14c8STreehugger Robot // CHECK-ERROR: ERROR: AddressSanitizer
25