Skip to content

Commit e620f10

Browse files
authored
[compiler-rt][sanitizer_common] Alter sanitizer_set_report_path_test to not assume a fixed file path (#139282)
Currently, `Posix/sanitizer_set_report_path_test.cpp` contains the following check: `// CHECK: ERROR: Can't create directory: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp`. This makes an assumption that the test file resides in `Posix/Output`, however when testing on a remote device, an alternative temporary directory path is used. This patch instead checks that the path in the error message matches the requested path dynamically.
1 parent 8188931 commit e620f10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ int main(int argc, char **argv) {
1818
// Try setting again with an invalid/inaccessible directory.
1919
char buff_bad[1000];
2020
sprintf(buff_bad, "%s/report", argv[0]);
21+
fprintf(stderr, "Expected bad report path: %s\n", buff_bad);
22+
// CHECK: Expected bad report path: [[BADPATH:.*]]/report
2123
__sanitizer_set_report_path(buff_bad);
2224
assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
2325
}
2426

25-
// CHECK: ERROR: Can't create directory: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp
27+
// CHECK: ERROR: Can't create directory: [[BADPATH]]

0 commit comments

Comments
 (0)