[compiler-rt] [compiler-rt][sanitizer_common] Alter sanitizer_set_report_path_test to not assume a fixed file path (PR #139282)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 08:55:28 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Dan Blackwell (DanBlackwell)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/139282.diff
1 Files Affected:
- (modified) compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp (+3-1)
``````````diff
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp
index 21ffe1381bd46..ab1017a2efc07 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp
@@ -18,8 +18,10 @@ int main(int argc, char **argv) {
// Try setting again with an invalid/inaccessible directory.
char buff_bad[1000];
sprintf(buff_bad, "%s/report", argv[0]);
+ fprintf(stderr, "Expected bad report path: %s\n", buff_bad);
+ // CHECK: Expected bad report path: [[BADPATH:.*]]/report
__sanitizer_set_report_path(buff_bad);
assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
}
-// CHECK: ERROR: Can't create directory: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp
+// CHECK: ERROR: Can't create directory: [[BADPATH]]
``````````
</details>
https://github.com/llvm/llvm-project/pull/139282
More information about the llvm-commits
mailing list