xref: /llvm-project/llvm/test/tools/llvm-ar/mri-thin-archive.test (revision 6a1e5f5a7111ce07a3beb8be366b63ea10fa56f4)
1# UNSUPPORTED: system-aix
2# RUN: rm -rf %t && mkdir -p %t/addlib/ && split-file %s %t
3# RUN: cd %t
4
5# RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o
6# RUN: cp %t/elf.o %t/addlib/elf.o
7# RUN: cp %t/elf.o %t/delete.o
8
9# RUN: llvm-ar rc --thin addlib/thin.ar addlib/elf.o
10# RUN: llvm-ar rc addlib/regular.ar addlib/elf.o
11
12# RUN: llvm-ar -M < thin.script
13# RUN: FileCheck -input-file=archive.ar %s --check-prefixes=THIN --implicit-check-not=delete.o --match-full-lines
14
15# THIN: !<thin>
16# THIN: elf.o/
17# THIN-NEXT: addlib/elf.o/
18
19# RUN: llvm-ar -M < thin-to-regular.script
20# RUN: FileCheck -input-file=regular.ar %s --check-prefixes=REGULAR
21
22# REGULAR: !<arch>
23
24# RUN: not llvm-ar -M < regular-to-thin.script 2>&1 | FileCheck %s --check-prefix=ERROR
25# RUN: not ls thin.ar
26# ERROR: error: script line 2: cannot add a regular archive's contents to a thin archive
27
28#--- thin.script
29createthin archive.ar
30addmod elf.o
31addlib addlib/thin.ar
32addmod delete.o
33delete delete.o
34save
35end
36
37#--- thin-to-regular.script
38create regular.ar
39addlib addlib/thin.ar
40save
41end
42
43#--- regular-to-thin.script
44createthin thin.ar
45addlib addlib/regular.ar
46save
47end
48