Skip to content

Commit 8be714b

Browse files
iii-ivitalybuka
andauthored
[sanitizer] Fix running sanitizer_set_report_path_test on Android (llvm#99469)
sanitizer_set_report_path_test outputs the following on an Android builder [1]: ERROR: Can't create directory: /data/local/tmp/Output/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/sanitizer_common/asan-arm-Android/Posix/Output/sanitizer_set_report_path_test.cpp.tmp Path /data/local/tmp/Output/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/sanitizer_common/asan-arm-Android/Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.24954 The order of messages is reversed. The test can use strcmp+assert instead of CHECK for `__sanitizer_get_report_path` output. [1] https://lab.llvm.org/buildbot/#/builders/186/builds/703/steps/26/logs/stdio --------- Co-authored-by: Vitaly Buka <[email protected]>
1 parent a41a4b8 commit 8be714b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ int main(int argc, char **argv) {
1414
sprintf(buff, "%s.report_path/report", argv[0]);
1515
__sanitizer_set_report_path(buff);
1616
assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
17-
printf("Path %s\n", __sanitizer_get_report_path());
18-
fflush(stdout);
1917

2018
// Try setting again with an invalid/inaccessible directory.
21-
sprintf(buff, "%s/report", argv[0]);
22-
__sanitizer_set_report_path(buff);
23-
printf("Path %s\n", __sanitizer_get_report_path());
19+
char buff_bad[1000];
20+
sprintf(buff_bad, "%s/report", argv[0]);
21+
__sanitizer_set_report_path(buff_bad);
22+
assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
2423
}
2524

26-
// CHECK: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.
2725
// CHECK: ERROR: Can't create directory: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp
28-
// CHECK-NOT: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp

0 commit comments

Comments
 (0)