1## Test that read-only archives cannot be edited
2
3# RUN: rm -rf %t && mkdir -p %t
4# RUN: touch %t/1.txt
5# RUN: touch %t/2.txt
6# RUN: touch %t/3.txt
7
8# RUN: llvm-ar rc %t/archive.a %t/1.txt %t/2.txt
9
10## Make read only:
11# RUN: chmod 444 %t/archive.a
12
13# RUN: not llvm-ar r %t/archive.a %t/3.txt \
14# RUN:   FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a
15
16# ERROR: error: [[FILE]]: no such file or directory
17
18# RUN: not llvm-ar q %t/archive.a %t/3.txt \
19# RUN:   FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a
20
21# RUN: not llvm-ar m %t/archive.a t/1.txt \
22# RUN:   FileCheck %s --check-prefix=ERROR-2 -DFILE=%t/archive.a
23
24# ERROR-2: error: [[FILE]]: permission denied
25
26# RUN: llvm-ar t %t/archive.a \
27# RUN:   | FileCheck %s --check-prefix=ARCHIVE --match-full-lines --implicit-check-not {{.}}
28
29# ARCHIVE: 1.txt
30# ARCHIVE-NEXT: 2.txt
31