[compiler-rt] 986afe8 - [sanitizer] Fix test to tolerate chmod not working as intended
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 13 11:56:18 PST 2022
Author: Teresa Johnson
Date: 2022-02-13T11:56:08-08:00
New Revision: 986afe847951a59cd66783e1377b13cec6412972
URL: https://github.com/llvm/llvm-project/commit/986afe847951a59cd66783e1377b13cec6412972
DIFF: https://github.com/llvm/llvm-project/commit/986afe847951a59cd66783e1377b13cec6412972.diff
LOG: [sanitizer] Fix test to tolerate chmod not working as intended
Attempts to fix a bot failure from
634da7a1c61ee8c173e90a841eb1f4ea03caa20b on an Android bot:
https://lab.llvm.org/buildbot#builders/77/builds/14339
It appears that the chmod is not making the directory unwritable as
expected on this system for some reason. Adopt an approach used in
compiler-rt/test/fuzzer/fuzzer-dirs.test for systems with
non-functioning chmod by including illegal characters in directory.
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 d176710a43c1b..6cd060ac703c8 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
@@ -1,11 +1,13 @@
// Test __sanitizer_set_report_path and __sanitizer_get_report_path:
// RUN: rm -rf %t.report_path
// RUN: %clangxx -O2 %s -o %t
-// RUN: %run %t | FileCheck %s
+// RUN: %run %t %t | FileCheck %s
// Try again with a directory without write access.
-// RUN: rm -rf %t.report_path && mkdir -p %t.report_path
-// RUN: chmod u-w %t.report_path || true
-// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=FAIL
+// RUN: rm -rf %t.baddir && mkdir -p %t.baddir
+// RUN: chmod u-w %t.baddir || true
+// Use invalid characters in directory name in case chmod doesn't work as
+// intended.
+// RUN: not %run %t %t.baddir/?bad? 2>&1 | FileCheck %s --check-prefix=FAIL
#include <assert.h>
#include <sanitizer/common_interface_defs.h>
@@ -16,11 +18,11 @@ volatile int *null = 0;
int main(int argc, char **argv) {
char buff[1000];
- sprintf(buff, "%s.report_path/report", argv[0]);
+ sprintf(buff, "%s.report_path/report", argv[1]);
__sanitizer_set_report_path(buff);
assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
printf("Path %s\n", __sanitizer_get_report_path());
}
// CHECK: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.
-// FAIL: ERROR: Can't open file: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.
+// FAIL: ERROR: Can't create directory: {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.baddir
More information about the llvm-commits
mailing list