[compiler-rt] 8be714b - [sanitizer] Fix running sanitizer_set_report_path_test on Android (#99469)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 15:00:39 PDT 2024


Author: Ilya Leoshkevich
Date: 2024-07-18T15:00:36-07:00
New Revision: 8be714b6724f1f2f57442f2cdd3a0625c053d872

URL: https://github.com/llvm/llvm-project/commit/8be714b6724f1f2f57442f2cdd3a0625c053d872
DIFF: https://github.com/llvm/llvm-project/commit/8be714b6724f1f2f57442f2cdd3a0625c053d872.diff

LOG: [sanitizer] Fix running sanitizer_set_report_path_test on Android (#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 <vitalybuka at gmail.com>

Added: 
    

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

Removed: 
    


################################################################################
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 286eafc315baf..21ffe1381bd46 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
@@ -14,15 +14,12 @@ int main(int argc, char **argv) {
   sprintf(buff, "%s.report_path/report", argv[0]);
   __sanitizer_set_report_path(buff);
   assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
-  printf("Path %s\n", __sanitizer_get_report_path());
-  fflush(stdout);
 
   // Try setting again with an invalid/inaccessible directory.
-  sprintf(buff, "%s/report", argv[0]);
-  __sanitizer_set_report_path(buff);
-  printf("Path %s\n", __sanitizer_get_report_path());
+  char buff_bad[1000];
+  sprintf(buff_bad, "%s/report", argv[0]);
+  __sanitizer_set_report_path(buff_bad);
+  assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
 }
 
-// CHECK: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.
 // CHECK: ERROR: Can't create directory: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp
-// CHECK-NOT: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp


        


More information about the llvm-commits mailing list