blob: b9562a36d67b5c9af9d0ae3da824d00f1d46fd1e [file] [log] [blame]
Rafael Espindola0aac01b2013-07-13 04:14:13 +00001Test the exact archive format. In particular, test which file names use the
2string table or not.
3
Rafael Espindola0aac01b2013-07-13 04:14:13 +00004RUN: mkdir -p %t
5RUN: cd %t
6
Rui Ueyama2241b842016-10-26 01:07:26 +00007RUN: printf bar. > 0123456789abcde
8RUN: printf zed. > 0123456789abcdef
Rafael Espindola57c05252015-07-15 23:15:33 +00009RUN: mkdir -p foo
Rui Ueyama2241b842016-10-26 01:07:26 +000010RUN: printf bar2 > foo/0123456789abcde
11RUN: printf zed2 > foo/0123456789abcdef
Rafael Espindola0aac01b2013-07-13 04:14:13 +000012
Rafael Espindola6a8e86f2015-07-13 20:38:09 +000013RUN: rm -f %t.a
Rafael Espindola57c05252015-07-15 23:15:33 +000014RUN: llvm-ar --format=gnu rc %t.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef
Rafael Espindola6a8e86f2015-07-13 20:38:09 +000015RUN: cat %t.a | FileCheck -strict-whitespace %s
Rafael Espindola0aac01b2013-07-13 04:14:13 +000016
17CHECK: !<arch>
Rafael Espindola57c05252015-07-15 23:15:33 +000018CHECK-NEXT: // 36 `
19CHECK-NEXT: 0123456789abcdef/
Rafael Espindola0aac01b2013-07-13 04:14:13 +000020CHECK-NEXT: 0123456789abcdef/
Rafael Espindola6a8e86f2015-07-13 20:38:09 +000021CHECK-NEXT: 0123456789abcde/0 0 0 644 4 `
Rafael Espindola57c05252015-07-15 23:15:33 +000022CHECK-NEXT: bar.
23CHECK-SAME: /0 0 0 0 644 4 `
NAKAMURA Takumi10d576d2015-03-03 15:54:48 +000024CHECK-NEXT: zed.
Rafael Espindola57c05252015-07-15 23:15:33 +000025CHECK-SAME: 0123456789abcde/0 0 0 644 4 `
26CHECK-NEXT: bar2
27CHECK-SAME: /18 0 0 0 644 4 `
28CHECK-NEXT: zed2
Rafael Espindolaa2ed0b02015-07-08 20:47:32 +000029
Rafael Espindola6a8e86f2015-07-13 20:38:09 +000030RUN: rm -f %t.a
31RUN: llvm-ar --format=bsd rc %t.a 0123456789abcde 0123456789abcdef
32RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=BSD %s
Rafael Espindolaa2ed0b02015-07-08 20:47:32 +000033
34BSD: !<arch>
Rafael Espindola6a8e86f2015-07-13 20:38:09 +000035BSD-NEXT: #1/20 0 0 0 644 24 `
Rafael Espindolaa2ed0b02015-07-08 20:47:32 +000036BSD-NEXT: 0123456789abcde{{.....}}bar.
Rafael Espindola6a8e86f2015-07-13 20:38:09 +000037BSD-SAME: #1/16 0 0 0 644 20 `
Rafael Espindolaa2ed0b02015-07-08 20:47:32 +000038BSD-NEXT: 0123456789abcdefzed.
Rafael Espindolae6492582015-07-15 05:47:46 +000039
Rafael Espindola06d6d192015-07-16 00:14:49 +000040RUN: rm -f test.a
41RUN: llvm-ar --format=gnu rcT test.a 0123456789abcde 0123456789abcdef
42RUN: cat test.a | FileCheck -strict-whitespace --check-prefix=THIN %s
Rafael Espindolae6492582015-07-15 05:47:46 +000043THIN: !<thin>
44THIN-NEXT: // 36 `
45THIN-NEXT: 0123456789abcde/
46THIN-NEXT: 0123456789abcdef/{{$}}
47THIN: {{^$}}
48THIN: /0 0 0 0 644 4 `
49THIN-NEXT: /17 0 0 0 644 4 `
Rafael Espindola06d6d192015-07-16 00:14:49 +000050
51RUN: mkdir -p bar
52RUN: rm -f bar/test.a
53RUN: llvm-ar --format=gnu rcT bar/test.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef
54RUN: cat bar/test.a | FileCheck -strict-whitespace --check-prefix=THIN-PATH %s
55THIN-PATH: !<thin>
56THIN-PATH-NEXT: // 90 `
Rafael Espindolae79b62d2015-07-16 00:38:34 +000057THIN-PATH-NEXT: ..{{/|\\}}0123456789abcde/
58THIN-PATH-NEXT: ..{{/|\\}}0123456789abcdef/
59THIN-PATH-NEXT: ..{{/|\\}}foo{{/|\\}}0123456789abcde/
60THIN-PATH-NEXT: ..{{/|\\}}foo{{/|\\}}0123456789abcdef/
Rafael Espindola06d6d192015-07-16 00:14:49 +000061THIN-PATH-NEXT: /0 0 0 0 644 4 `
62THIN-PATH-NEXT: /20 0 0 0 644 4 `
63THIN-PATH-NEXT: /41 0 0 0 644 4 `
64THIN-PATH-NEXT: /65 0 0 0 644 4 `
Rafael Espindola21507a42016-05-02 21:06:57 +000065
66RUN: not llvm-ar --format=bsd rcT bad.a 0123456789abcde 0123456789abcdef 2>&1 | FileCheck --check-prefix=BSD-THIN %s
67BSD-THIN: Only the gnu format has a thin mode.