blob: 44d76b4dd1fba0623cbd2dae1a02edc70cfcc1f2 [file] [log] [blame]
Rafael Espindola3b5475c2013-07-10 21:47:16 +00001; This test just makes sure that llvm-ar can extract bytecode members
2; from various style archives.
3
Kuba Mracek2c0bca42017-08-20 18:18:44 +00004; RUN: rm -rf %t && mkdir -p %t && cd %t
Rafael Espindola54dbca52013-07-11 13:13:09 +00005
6; RUN: rm -f very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +00007; RUN: llvm-ar p %p/Inputs/GNU.a very_long_bytecode_file_name.bc | \
8; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
Rafael Espindola54dbca52013-07-11 13:13:09 +00009; RUN: llvm-ar x %p/Inputs/GNU.a very_long_bytecode_file_name.bc
10; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
11; RUN: very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +000012
Rafael Espindola54dbca52013-07-11 13:13:09 +000013; RUN: rm -f very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +000014; RUN: llvm-ar p %p/Inputs/MacOSX.a very_long_bytecode_file_name.bc | \
15; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
Rafael Espindola54dbca52013-07-11 13:13:09 +000016; RUN: llvm-ar x %p/Inputs/MacOSX.a very_long_bytecode_file_name.bc
17; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
18; RUN: very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +000019
Rafael Espindola54dbca52013-07-11 13:13:09 +000020; RUN: rm -f very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +000021; RUN: llvm-ar p %p/Inputs/SVR4.a very_long_bytecode_file_name.bc | \
22; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
Rafael Espindola54dbca52013-07-11 13:13:09 +000023; RUN: llvm-ar x %p/Inputs/SVR4.a very_long_bytecode_file_name.bc
24; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
25; RUN: very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +000026
Rafael Espindola54dbca52013-07-11 13:13:09 +000027; RUN: rm -f very_long_bytecode_file_name.bc
Rafael Espindola3b5475c2013-07-10 21:47:16 +000028; RUN: llvm-ar p %p/Inputs/xpg4.a very_long_bytecode_file_name.bc |\
29; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
Rafael Espindola54dbca52013-07-11 13:13:09 +000030; RUN: llvm-ar x %p/Inputs/xpg4.a very_long_bytecode_file_name.bc
31; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
32; RUN: very_long_bytecode_file_name.bc
Rafael Espindola3e7249f2013-07-12 18:51:25 +000033
34
35; Test that the 'o' option is working by extracting a file, putting it in o
36; new archive and checking that date.
37; RUN: rm -f very_long_bytecode_file_name.bc
38; RUN: llvm-ar xo %p/Inputs/GNU.a very_long_bytecode_file_name.bc
Bill Wendling2f98bac2014-01-16 07:08:22 +000039; RUN: rm -f %t.a
Fangrui Song9caa6b52019-05-01 15:31:15 +000040; RUN: llvm-ar --format=gnu rcU %t.a very_long_bytecode_file_name.bc
Saleem Abdulrasool864bd172017-02-09 20:06:30 +000041; RUN: env TZ=GMT llvm-ar tv %t.a | FileCheck %s -check-prefix CHECK-GNU
Rafael Espindola3e7249f2013-07-12 18:51:25 +000042
Jordan Rupprecht34c0e472018-10-05 23:25:39 +000043CHECK-GNU: 1465 Nov 19 03:01 2004 very_long_bytecode_file_name.bc
Rafael Espindolac3eec452015-07-14 16:02:40 +000044
Saleem Abdulrasool864bd172017-02-09 20:06:30 +000045; RUN: rm -f %t.a
Fangrui Song9caa6b52019-05-01 15:31:15 +000046; RUN: llvm-ar --format=darwin rcU %t.a very_long_bytecode_file_name.bc
Rafael Espindola23a76be2017-02-21 20:40:54 +000047; RUN: env TZ=GMT llvm-ar tv %t.a | FileCheck %s -check-prefix CHECK-DARWIN
Saleem Abdulrasool864bd172017-02-09 20:06:30 +000048
Jordan Rupprecht34c0e472018-10-05 23:25:39 +000049CHECK-DARWIN: 1472 Nov 19 03:01 2004 very_long_bytecode_file_name.bc
Rafael Espindolac3eec452015-07-14 16:02:40 +000050
51RUN: not llvm-ar x %p/Inputs/GNU.a foo.o 2>&1 | FileCheck --check-prefix=NOTFOUND %s
Jordan Rupprecht20a817e2019-01-15 22:03:08 +000052NOTFOUND: error: 'foo.o' was not found
Rafael Espindolae549b8c2015-07-14 16:55:13 +000053
54RUN: not llvm-ar x %p/Inputs/thin.a foo.o 2>&1 | FileCheck %s --check-prefix=THINEXTRACT
55THINEXTRACT: extracting from a thin archive is not supported
Rafael Espindola4b83cb52015-07-14 22:18:43 +000056
57RUN: llvm-ar p %p/Inputs/thin.a evenlen | FileCheck %s --check-prefix=EVENLEN
58EVENLEN: evenlen
59
Davide Italiano79ebe312017-04-05 14:52:17 +000060RUN: not llvm-ar p %p/Inputs/thin-path.a t/test2.o 2>&1 | FileCheck %s --check-prefix=MISSING
Rafael Espindola142fc2d2015-07-14 22:42:21 +000061MISSING: {{N|n}}o such file or directory.