4 # RUN: rm -rf %t && mkdir -p %t
5 # RUN: echo file1 > %t/1.txt
6 # RUN: echo file2 > %t/2.txt
7 # RUN: echo file3 > %t/3.txt
9 # RUN: llvm-ar -rc %t/archive.a %t/1.txt %t/2.txt %t/3.txt
11 ## Print empty archive:
12 # RUN: llvm-ar --format=gnu cr %t/empty.a
13 # RUN: llvm-ar p %t/empty.a 2>&1 | count 0
14 # RUN: llvm-ar pv %t/empty.a 2>&1 | count 0
16 ## Print without member:
17 # RUN: llvm-ar p %t/archive.a \
18 # RUN: | FileCheck %s --check-prefix=WITHOUT --match-full-lines --implicit-check-not {{.}}
24 # RUN: llvm-ar pv %t/archive.a \
25 # RUN: | FileCheck %s --check-prefix=WITHOUT-VERBOSE --match-full-lines --implicit-check-not {{.}}
27 # WITHOUT-VERBOSE: Printing 1.txt
28 # WITHOUT-VERBOSE-NEXT: file1
29 # WITHOUT-VERBOSE-NEXT: Printing 2.txt
30 # WITHOUT-VERBOSE-NEXT: file2
31 # WITHOUT-VERBOSE-NEXT: Printing 3.txt
32 # WITHOUT-VERBOSE-NEXT: file3
34 ## Print single member:
35 # RUN: llvm-ar p %t/archive.a %t/2.txt \
36 # RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}
40 # RUN: llvm-ar pv %t/archive.a %t/2.txt \
41 # RUN: | FileCheck %s --check-prefix=SINGLE-VERBOSE --match-full-lines --implicit-check-not {{.}}
43 # SINGLE-VERBOSE: Printing 2.txt
44 # SINGLE-VERBOSE-NEXT: file2
46 ## Print multiple members:
47 # RUN: llvm-ar p %t/archive.a %t/2.txt %t/1.txt \
48 # RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}
51 # MULTIPLE-NEXT: file2
53 # RUN: llvm-ar pv %t/archive.a %t/2.txt %t/1.txt \
54 # RUN: | FileCheck %s --check-prefix=MULTIPLE-VERBOSE --match-full-lines --implicit-check-not {{.}}
56 # MULTIPLE-VERBOSE: Printing 1.txt
57 # MULTIPLE-VERBOSE-NEXT: file1
58 # MULTIPLE-VERBOSE-NEXT: Printing 2.txt
59 # MULTIPLE-VERBOSE-NEXT: file2
62 # RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \
63 # RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt
66 # SAME-DAG: error: '[[FILE]]' was not found
68 ## Print same member when containing multiple members with shared name:
69 # llvm-ar -q %t/archive.a %t/2.txt
70 # RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \
71 # RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt
74 # RUN: not llvm-ar p 2>&1 \
75 # RUN: | FileCheck %s --check-prefix=NO-ARCHIVE
77 # NO-ARCHIVE: error: an archive name must be specified
79 ## Archive does not exist:
80 # RUN: not llvm-ar p %t/missing.a 2>&1 \
81 # RUN: | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a
83 # MISSING-ARCHIVE: error: unable to load '[[ARCHIVE]]': [[MSG]]
85 ## Member does not exist:
86 # RUN: not llvm-ar p %t/archive.a %t-missing.txt 2>&1 \
87 # RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t-missing.txt
89 # MISSING-FILE: error: '[[FILE]]' was not found
91 ## Print empty thin archive:
92 # RUN: llvm-ar Trc %t/thin-archive-empty.a
93 # RUN: llvm-ar p %t/thin-archive-empty.a 2>&1 | count 0
94 # RUN: llvm-ar pv %t/thin-archive-empty.a 2>&1 | count 0
96 ## Print thin archive:
97 # RUN: llvm-ar Trc %t/thin-archive.a %t/1.txt %t/2.txt %t/3.txt
98 # RUN: llvm-ar p %t/archive.a %t/2.txt \
99 # RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}