3 # RUN: rm -rf %t && mkdir -p %t
4 # RUN: yaml2obj %s -o %t/1.o --docnum=1
5 # RUN: yaml2obj %s -o %t/2.o --docnum=2
7 ## Append single member:
8 # RUN: llvm-ar qc %t/single.a %t/1.o
9 # RUN: llvm-ar t %t/single.a \
10 # RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}
14 # RUN: llvm-nm --print-armap %t/single.a \
15 # RUN: | FileCheck %s --check-prefix=SINGLE-SYM
19 ## Append multiple members:
20 # RUN: llvm-ar qc %t/multiple.a %t/1.o %t/2.o
21 # RUN: llvm-ar t %t/multiple.a \
22 # RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}
25 # MULTIPLE-NEXT: 2.o{{$}}
27 # RUN: llvm-nm --print-armap %t/multiple.a \
28 # RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
30 # MULTIPLE-SYM: symbol1 in 1.o
31 # MULTIPLE-SYM-NEXT: symbol2 in 2.o
33 ## Append same member:
34 # RUN: llvm-ar qc %t/same.a %t/1.o %t/1.o
35 # RUN: llvm-ar t %t/same.a \
36 # RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --match-full-lines --implicit-check-not {{.}}
41 # RUN: llvm-nm --print-armap %t/same.a \
42 # RUN: | FileCheck %s --check-prefix=SAME-SYM
44 # SAME-SYM: symbol1 in 1.o
45 # SAME-SYM-NEXT: symbol1 in 1.o
47 ## Append without member:
48 # RUN: llvm-ar qc %t/without.a
49 # RUN: llvm-ar t %t/without.a | count 0
51 # RUN: llvm-nm --print-armap %t/without.a | count 0
54 # RUN: not llvm-ar qc 2>&1 \
55 # RUN: | FileCheck %s --check-prefix=NO-ARCHIVE
57 # NO-ARCHIVE: error: an archive name must be specified
59 ## Member does not exist:
60 # RUN: not llvm-ar qc %t/missing.a %t/missing.txt 2>&1 \
61 # RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt -DMSG=%errc_ENOENT
63 # MISSING-FILE: error: [[FILE]]: [[MSG]]
65 ## Create and append members to a thin archive:
66 # RUN: llvm-ar qcT %t/thin-multiple.a %t/1.o
67 # RUN: llvm-ar qcT %t/thin-multiple.a %t/2.o
68 # RUN: llvm-ar t %t/thin-multiple.a \
69 # RUN: | FileCheck %s --check-prefix=MULTIPLE
71 # RUN: llvm-ar qcT %t/thin-same.a %t/1.o %t/1.o
72 # RUN: llvm-ar t %t/thin-same.a \
73 # RUN: | FileCheck %s --check-prefix=SAME