Skip to content

Commit 986f519

Browse files
authored
[Sanitizer][test] Emit to stderr to fix android (#142207)
This test is broken on android by #141820 https://lab.llvm.org/buildbot/#/builders/186/builds/9498 > FileCheck error: '' is empty. I suspect that on android printf only works if its emitted to stderr because this use to work https://github.com/llvm/llvm-project/blob/a2ce5647200ad40ae356affd44db7d054de444d2/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp#L21-L22 Only emit to stderr and see if that fixes the test.
1 parent d4791f5 commit 986f519

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Test __sanitizer_set_report_path and __sanitizer_get_report_path:
22
// RUN: %clangxx -O2 %s -o %t
3-
// RUN: %env HOME=%t.homedir TMPDIR=%t.tmpdir %run %t 2>%t.err | FileCheck %s
4-
// RUN: FileCheck %s --input-file=%t.err --check-prefix=ERROR
3+
// RUN: %env HOME=%t.homedir TMPDIR=%t.tmpdir %run %t 2>&1 | FileCheck %s
54

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

1716
strcpy(buff, "%H/foo");
1817
__sanitizer_set_report_path(buff);
1918
// CHECK: [[T:.*]].homedir/foo.[[PID]]
20-
printf("%s\n", __sanitizer_get_report_path());
19+
fprintf(stderr, "%s\n", __sanitizer_get_report_path());
2120

2221
strcpy(buff, "%t/foo");
2322
__sanitizer_set_report_path(buff);
2423
// CHECK: [[T]].tmpdir/foo.[[PID]]
25-
printf("%s\n", __sanitizer_get_report_path());
24+
fprintf(stderr, "%s\n", __sanitizer_get_report_path());
2625

2726
strcpy(buff, "%H/%p/%%foo");
2827
__sanitizer_set_report_path(buff);
2928
// CHECK: [[T]].homedir/[[PID]]/%foo.[[PID]]
30-
printf("%s\n", __sanitizer_get_report_path());
29+
fprintf(stderr, "%s\n", __sanitizer_get_report_path());
3130

3231
strcpy(buff, "%%foo%%bar");
3332
__sanitizer_set_report_path(buff);
3433
// CHECK: %foo%bar.[[PID]]
35-
printf("%s\n", __sanitizer_get_report_path());
34+
fprintf(stderr, "%s\n", __sanitizer_get_report_path());
3635

3736
strcpy(buff, "%%foo%ba%%r");
3837
__sanitizer_set_report_path(buff);
39-
// ERROR: Unexpected pattern: %%foo%ba%%r
38+
// CHECK: Unexpected pattern: %%foo%ba%%r
4039
// CHECK: %%foo%ba%%r.[[PID]]
41-
printf("%s\n", __sanitizer_get_report_path());
40+
fprintf(stderr, "%s\n", __sanitizer_get_report_path());
4241
}

0 commit comments

Comments
 (0)