1// Test __sanitizer_set_report_path and __sanitizer_get_report_path:
2// RUN: %clangxx -O2 %s -o %t
3// RUN: %run %t | FileCheck %s
4
5#include <assert.h>
6#include <sanitizer/common_interface_defs.h>
7#include <stdio.h>
8#include <string.h>
9
10volatile int *null = 0;
11
12int main(int argc, char **argv) {
13 char buff[1000];
14 sprintf(s: buff, format: "%s.report_path/report", argv[0]);
15 __sanitizer_set_report_path(path: buff);
16 assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
17 printf(format: "Path %s\n", __sanitizer_get_report_path());
18}
19
20// CHECK: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.
21

source code of compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp