[compiler-rt] 910aeed - sanitizer_common: fix up onprint.cpp test

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 09:17:20 PDT 2021


Author: Dmitry Vyukov
Date: 2021-10-27T18:17:15+02:00
New Revision: 910aeed77e92dd313cb3f7928803d112154ae5aa

URL: https://github.com/llvm/llvm-project/commit/910aeed77e92dd313cb3f7928803d112154ae5aa
DIFF: https://github.com/llvm/llvm-project/commit/910aeed77e92dd313cb3f7928803d112154ae5aa.diff

LOG: sanitizer_common: fix up onprint.cpp test

Commit D112602 ("sanitizer_common: tighten on_print hook test")
changed fopen to open in this test. fopen created the file
if if does not exist, but open does not. This was unnoticed
during local testing because lit is not hermetic and reuses
files from previous runs, but it started failing on bots.
Fix the open call.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112630

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/onprint.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp b/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp
index 8779efbb237d..29e38fae3ce3 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp
@@ -26,7 +26,7 @@ __sanitizer_on_print(const char *str) {
 
 int main(int argc, char *argv[]) {
   assert(argc >= 2);
-  f = open(argv[1], O_WRONLY);
+  f = open(argv[1], O_CREAT | O_WRONLY, 0666);
 
   // Use-after-free to trigger ASan/TSan reports.
   void *ptr = malloc(1);


        


More information about the llvm-commits mailing list