1 Test the exact archive format. In particular, test which file names use the
7 RUN: printf bar. > 0123456789abcde
8 RUN: printf zed. > 0123456789abcdef
10 RUN: printf bar2 > foo/0123456789abcde
11 RUN: printf zed2 > foo/0123456789abcdef
14 RUN: llvm-ar --format=gnu rc %t.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef
15 RUN: cat %t.a | FileCheck -strict-whitespace %s
19 CHECK-NEXT: 0123456789abcdef/
20 CHECK-NEXT: 0123456789abcde/0 0 0 644 4 `
22 CHECK-SAME: /0 0 0 0 644 4 `
24 CHECK-SAME: 0123456789abcde/0 0 0 644 4 `
26 CHECK-SAME: /0 0 0 0 644 4 `
30 RUN: llvm-ar --format=bsd rc %t.a 0123456789abcde 0123456789abcdef
31 RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=BSD %s
34 BSD-NEXT: #1/20 0 0 0 644 24 `
35 BSD-NEXT: 0123456789abcde{{.....}}bar.
36 BSD-SAME: #1/16 0 0 0 644 20 `
37 BSD-NEXT: 0123456789abcdefzed.
40 RUN: llvm-ar --format=darwin rcS %t.a 0123456789abcde 0123456789abcdef
41 RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=DARWIN %s
44 DARWIN-NEXT: #1/20 0 0 0 644 28 `
45 Each [[:space:]] matches a newline. We explicitly match 3 newlines, as the
46 fourth newline is implicitly consumed by FileCheck and cannot be matched.
47 DARWIN-NEXT: 0123456789abcde{{.....}}bar.{{[[:space:]][[:space:]][[:space:]]}}
48 DARWIN-NEXT: #1/20 0 0 0 644 28 `
49 DARWIN-NEXT: 0123456789abcdef{{....}}zed.
53 RUN: llvm-ar --format=gnu rcT test.a 0123456789abcde 0123456789abcdef
54 RUN: cat test.a | FileCheck -strict-whitespace --check-prefix=THIN %s
57 THIN-NEXT: 0123456789abcde/
58 THIN-NEXT: 0123456789abcdef/{{$}}
60 THIN: /0 0 0 0 644 4 `
61 THIN-NEXT: /17 0 0 0 644 4 `
65 RUN: llvm-ar --format=gnu rcT bar/test.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef
66 RUN: cat bar/test.a | FileCheck -strict-whitespace --check-prefix=THIN-PATH %s
68 THIN-PATH-NEXT: // 90 `
69 THIN-PATH-NEXT: ..{{/|\\}}0123456789abcde/
70 THIN-PATH-NEXT: ..{{/|\\}}0123456789abcdef/
71 THIN-PATH-NEXT: ..{{/|\\}}foo{{/|\\}}0123456789abcde/
72 THIN-PATH-NEXT: ..{{/|\\}}foo{{/|\\}}0123456789abcdef/
73 THIN-PATH-NEXT: /0 0 0 0 644 4 `
74 THIN-PATH-NEXT: /20 0 0 0 644 4 `
75 THIN-PATH-NEXT: /41 0 0 0 644 4 `
76 THIN-PATH-NEXT: /65 0 0 0 644 4 `
78 RUN: not llvm-ar --format=bsd rcT bad.a 0123456789abcde 0123456789abcdef 2>&1 | FileCheck --check-prefix=BSD-THIN %s
79 BSD-THIN: error: only the gnu format has a thin mode
81 If an archive has an object with no symbols, the linker and some other
82 tools on some versions of Solaris will abort operations if there is no
83 symbol table. Create such an object, put it into an archive, and check to
84 see that there is an empty symbol table.
86 RUN: yaml2obj %S/Inputs/solaris-nosymbols.yaml -o %t/foo.o
87 RUN: llvm-ar rs %t/foo.a %t/foo.o
88 RUN: cat -v %t/foo.a | FileCheck -strict-whitespace --check-prefix=SOLARIS %s
90 SOLARIS-NEXT: / 0 0 0 0 8 `
91 SOLARIS-NEXT: ^@^@^@^@^@^@^@^@foo.o/
93 RUN: not llvm-ar -format=gnu rc %t.a 0123456789abcde 2>&1 | FileCheck --check-prefix=ONE-DASH %s
94 ONE-DASH: error: unknown option f