forked from OSchip/llvm-project
[sanitizer] Fix test to tolerate chmod not working as intended
Attempts to fix a bot failure from
634da7a1c6
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.
This commit is contained in:
parent
06df1a2eff
commit
986afe8479
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue