Skip to content

[Sanitizer][test] Emit to stderr to fix android #142207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Test __sanitizer_set_report_path and __sanitizer_get_report_path:
// RUN: %clangxx -O2 %s -o %t
// RUN: %env HOME=%t.homedir TMPDIR=%t.tmpdir %run %t 2>%t.err | FileCheck %s
// RUN: FileCheck %s --input-file=%t.err --check-prefix=ERROR
// RUN: %env HOME=%t.homedir TMPDIR=%t.tmpdir %run %t 2>&1 | FileCheck %s

#include <sanitizer/common_interface_defs.h>
#include <stdio.h>
Expand All @@ -12,31 +11,31 @@ int main(int argc, char **argv) {
sprintf(buff, "%s.report_path/report", argv[0]);
__sanitizer_set_report_path(buff);
// CHECK: {{.*}}.report_path/report.[[PID:[0-9]+]]
printf("%s\n", __sanitizer_get_report_path());
fprintf(stderr, "%s\n", __sanitizer_get_report_path());

strcpy(buff, "%H/foo");
__sanitizer_set_report_path(buff);
// CHECK: [[T:.*]].homedir/foo.[[PID]]
printf("%s\n", __sanitizer_get_report_path());
fprintf(stderr, "%s\n", __sanitizer_get_report_path());

strcpy(buff, "%t/foo");
__sanitizer_set_report_path(buff);
// CHECK: [[T]].tmpdir/foo.[[PID]]
printf("%s\n", __sanitizer_get_report_path());
fprintf(stderr, "%s\n", __sanitizer_get_report_path());

strcpy(buff, "%H/%p/%%foo");
__sanitizer_set_report_path(buff);
// CHECK: [[T]].homedir/[[PID]]/%foo.[[PID]]
printf("%s\n", __sanitizer_get_report_path());
fprintf(stderr, "%s\n", __sanitizer_get_report_path());

strcpy(buff, "%%foo%%bar");
__sanitizer_set_report_path(buff);
// CHECK: %foo%bar.[[PID]]
printf("%s\n", __sanitizer_get_report_path());
fprintf(stderr, "%s\n", __sanitizer_get_report_path());

strcpy(buff, "%%foo%ba%%r");
__sanitizer_set_report_path(buff);
// ERROR: Unexpected pattern: %%foo%ba%%r
// CHECK: Unexpected pattern: %%foo%ba%%r
// CHECK: %%foo%ba%%r.[[PID]]
printf("%s\n", __sanitizer_get_report_path());
fprintf(stderr, "%s\n", __sanitizer_get_report_path());
}
Loading