[clang-tools-extra] 5c17af4 - [clang-tools-extra][test] Ensure file is writeable after copying (#157728)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 9 11:23:18 PDT 2025


Author: Jordan Rupprecht
Date: 2025-09-09T13:23:14-05:00
New Revision: 5c17af419ec7e9c823a1ae9287baeed0d27336ce

URL: https://github.com/llvm/llvm-project/commit/5c17af419ec7e9c823a1ae9287baeed0d27336ce
DIFF: https://github.com/llvm/llvm-project/commit/5c17af419ec7e9c823a1ae9287baeed0d27336ce.diff

LOG: [clang-tools-extra][test] Ensure file is writeable after copying (#157728)

After #157572, the invocation to clang-tidy fails w/ `Could not open
<...>/crlf.cpp.tmp.dir/Inputs/crlf/crlf.cpp for writing` if run in an
environment where the source tree is mounted read-only. This is because
`cat` was creating a new file in a writeable dir, but running `cp`
preserves the readonly file permissions from the source tree.

Added: 
    

Modified: 
    clang-tools-extra/test/clang-apply-replacements/crlf.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-apply-replacements/crlf.cpp b/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
index 266f806e70b95..40c48fd5e79b8 100644
--- a/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
+++ b/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
@@ -1,5 +1,6 @@
 // RUN: mkdir -p %t.dir/Inputs/crlf
 // RUN: cp %S/Inputs/crlf/crlf.cpp %t.dir/Inputs/crlf/crlf.cpp
+// RUN: chmod u+w %t.dir/Inputs/crlf/crlf.cpp
 // RUN: sed "s#\$(path)#%/t.dir/Inputs/crlf#" %S/Inputs/crlf/file1.yaml > %t.dir/Inputs/crlf/file1.yaml
 // RUN: clang-apply-replacements %t.dir/Inputs/crlf
 // RUN: 
diff  %t.dir/Inputs/crlf/crlf.cpp %S/Inputs/crlf/crlf.cpp.expected


        


More information about the cfe-commits mailing list