95 lines · plain
1Test the exact archive format. In particular, test which file names use the2string table or not.3 4RUN: mkdir -p %t5RUN: cd %t6 7RUN: printf bar. > 0123456789abcde8RUN: printf zed. > 0123456789abcdef9RUN: mkdir -p foo10RUN: printf bar2 > foo/0123456789abcde11RUN: printf zed2 > foo/0123456789abcdef12 13RUN: rm -f %t.a14RUN: llvm-ar --format=gnu rc %t.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef15RUN: cat %t.a | FileCheck -strict-whitespace %s16 17CHECK: !<arch>18CHECK-NEXT: // 18 `19CHECK-NEXT: 0123456789abcdef/20CHECK-NEXT: 0123456789abcde/0 0 0 644 4 `21CHECK-NEXT: bar.22CHECK-SAME: /0 0 0 0 644 4 `23CHECK-NEXT: zed.24CHECK-SAME: 0123456789abcde/0 0 0 644 4 `25CHECK-NEXT: bar226CHECK-SAME: /0 0 0 0 644 4 `27CHECK-NEXT: zed228 29RUN: rm -f %t.a30RUN: llvm-ar --format=bsd rc %t.a 0123456789abcde 0123456789abcdef31RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=BSD %s32 33BSD: !<arch>34BSD-NEXT: #1/20 0 0 0 644 24 `35BSD-NEXT: 0123456789abcde{{.....}}bar.36BSD-SAME: #1/16 0 0 0 644 20 `37BSD-NEXT: 0123456789abcdefzed.38 39RUN: rm -f %t.a40RUN: llvm-ar --format=darwin rcS %t.a 0123456789abcde 0123456789abcdef41RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=DARWIN %s42 43DARWIN: !<arch>44DARWIN-NEXT: #1/20 0 0 0 644 28 `45Each [[:space:]] matches a newline. We explicitly match 3 newlines, as the46fourth newline is implicitly consumed by FileCheck and cannot be matched.47DARWIN-NEXT: 0123456789abcde{{.....}}bar.{{[[:space:]][[:space:]][[:space:]]}}48DARWIN-NEXT: #1/20 0 0 0 644 28 `49DARWIN-NEXT: 0123456789abcdef{{....}}zed.50 51 52RUN: rm -f test.a53RUN: llvm-ar --format=gnu rcT test.a 0123456789abcde 0123456789abcdef54RUN: cat test.a | FileCheck -strict-whitespace --check-prefix=THIN %s55THIN: !<thin>56THIN-NEXT: // 36 `57THIN-NEXT: 0123456789abcde/58THIN-NEXT: 0123456789abcdef/{{$}}59THIN: {{^$}}60THIN: /0 0 0 0 644 4 `61THIN-NEXT: /17 0 0 0 644 4 `62 63RUN: mkdir -p bar64RUN: rm -f bar/test.a65RUN: llvm-ar --format=gnu rcT bar/test.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef66RUN: cat bar/test.a | FileCheck -strict-whitespace --check-prefix=THIN-PATH %s67THIN-PATH: !<thin>68THIN-PATH-NEXT: // 90 `69THIN-PATH-NEXT: ..{{/|\\}}0123456789abcde/70THIN-PATH-NEXT: ..{{/|\\}}0123456789abcdef/71THIN-PATH-NEXT: ..{{/|\\}}foo{{/|\\}}0123456789abcde/72THIN-PATH-NEXT: ..{{/|\\}}foo{{/|\\}}0123456789abcdef/73THIN-PATH-NEXT: /0 0 0 0 644 4 `74THIN-PATH-NEXT: /20 0 0 0 644 4 `75THIN-PATH-NEXT: /41 0 0 0 644 4 `76THIN-PATH-NEXT: /65 0 0 0 644 4 `77 78RUN: not llvm-ar --format=bsd rcT bad.a 0123456789abcde 0123456789abcdef 2>&1 | FileCheck --check-prefix=BSD-THIN %s79BSD-THIN: error: only the gnu format has a thin mode80 81If an archive has an object with no symbols, the linker and some other82tools on some versions of Solaris will abort operations if there is no83symbol table. Create such an object, put it into an archive, and check to84see that there is an empty symbol table.85RUN: mkdir -p %t86RUN: yaml2obj %S/Inputs/solaris-nosymbols.yaml -o %t/foo.o87RUN: llvm-ar rs %t/foo.a %t/foo.o88RUN: cat -v %t/foo.a | FileCheck -strict-whitespace --check-prefix=SOLARIS %s89SOLARIS: !<arch>90SOLARIS-NEXT: / 0 0 0 0 8 `91SOLARIS-NEXT: ^@^@^@^@^@^@^@^@foo.o/92 93RUN: not llvm-ar -format=gnu rc %t.a 0123456789abcde 2>&1 | FileCheck --check-prefix=ONE-DASH %s94ONE-DASH: error: unknown option f95