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 without member:
12 RUN: llvm-ar p %t/archive.a \
13 RUN: | FileCheck %s --check-prefix=WITHOUT --match-full-lines --implicit-check-not {{.}}
19 RUN: llvm-ar pv %t/archive.a \
20 RUN: | FileCheck %s --check-prefix=WITHOUT-VERBOSE --match-full-lines --implicit-check-not {{.}}
22 WITHOUT-VERBOSE: Printing 1.txt
23 WITHOUT-VERBOSE-NEXT: file1
24 WITHOUT-VERBOSE-NEXT: Printing 2.txt
25 WITHOUT-VERBOSE-NEXT: file2
26 WITHOUT-VERBOSE-NEXT: Printing 3.txt
27 WITHOUT-VERBOSE-NEXT: file3
29 # Print single member:
30 RUN: llvm-ar p %t/archive.a %t/2.txt \
31 RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}
35 RUN: llvm-ar pv %t/archive.a %t/2.txt \
36 RUN: | FileCheck %s --check-prefix=SINGLE-VERBOSE --match-full-lines --implicit-check-not {{.}}
38 SINGLE-VERBOSE: Printing 2.txt
39 SINGLE-VERBOSE-NEXT: file2
41 # Print multiple members:
42 RUN: llvm-ar p %t/archive.a %t/2.txt %t/1.txt \
43 RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}
48 RUN: llvm-ar pv %t/archive.a %t/2.txt %t/1.txt \
49 RUN: | FileCheck %s --check-prefix=MULTIPLE-VERBOSE --match-full-lines --implicit-check-not {{.}}
51 MULTIPLE-VERBOSE: Printing 1.txt
52 MULTIPLE-VERBOSE-NEXT: file1
53 MULTIPLE-VERBOSE-NEXT: Printing 2.txt
54 MULTIPLE-VERBOSE-NEXT: file2
57 RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \
58 RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt
61 SAME-DAG: error: '[[FILE]]' was not found
63 # Print same member when containing multiple members with shared name:
64 llvm-ar -q %t/archive.a %t/2.txt
65 RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \
66 RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt
69 RUN: not llvm-ar p 2>&1 \
70 RUN: | FileCheck %s --check-prefix=NO-ARCHIVE
72 NO-ARCHIVE: error: an archive name must be specified
74 # Archive does not exist:
75 RUN: not llvm-ar p %t/missing.a 2>&1 \
76 RUN: | FileCheck %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a
78 MISSING-ARCHIVE: error: error loading '[[ARCHIVE]]': {{[nN]}}o such file or directory
80 # Member does not exist:
81 RUN: not llvm-ar p %t/archive.a %t-missing.txt 2>&1 \
82 RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t-missing.txt
84 MISSING-FILE: error: '[[FILE]]' was not found