xref: /llvm-project/llvm/test/tools/llvm-ar/mri-create.test (revision 7de277d684fdbb12f5bfa761efe7dbbed681137d)
1## Test the CREATE MRI command.
2
3# RUN: rm -rf %t && mkdir -p %t/path/ && split-file %s %t
4# RUN: cd %t
5
6# RUN: llvm-ar -M < create.mri
7# RUN: llvm-ar -M < thin.mri
8
9## Test use of CREATE with no archive name.
10# RUN: not llvm-ar -M < none.mri 2>&1 | FileCheck --check-prefix=NONE %s
11# RUN: not llvm-ar -M < thin-none.mri 2>&1 | FileCheck --check-prefix=NONE %s
12# RUN: not llvm-ar -M < none-add.mri 2>&1 | FileCheck --check-prefix=NONE %s
13# RUN: not llvm-ar -M < thin-none-add.mri 2>&1 | FileCheck --check-prefix=NONE %s
14
15# NONE: error: script line 1: missing archive name
16
17## Test use of paths with CREATE.
18# RUN: llvm-ar -M < path.mri
19# RUN: ls path/path.a
20# RUN: llvm-ar -M < thin-path.mri
21# RUN: ls path/thin-path.a
22
23## Test bad paths with CREATE.
24# RUN: not llvm-ar -M < bad.mri 2>&1 | FileCheck --check-prefix=BAD -DMSG=%errc_ENOENT %s
25# RUN: not llvm-ar -M < thin-bad.mri 2>&1 | FileCheck --check-prefix=BAD -DMSG=%errc_ENOENT %s
26# BAD: error: bad/bad.a: [[MSG]]
27
28## Test duplicate use of CREATE.
29# RUN: not llvm-ar -M < create2.mri 2>&1 | FileCheck --check-prefix=MULTIPLE %s -DLINE=2
30# RUN: not llvm-ar -M < thin2.mri 2>&1 | FileCheck --check-prefix=MULTIPLE %s -DLINE=2
31# RUN: not llvm-ar -M < mix1.mri 2>&1 | FileCheck --check-prefix=MULTIPLE %s -DLINE=2
32# RUN: not llvm-ar -M < mix2.mri 2>&1 | FileCheck --check-prefix=MULTIPLE %s -DLINE=2
33# RUN: not llvm-ar -M < save.mri 2>&1 | FileCheck --check-prefix=MULTIPLE %s -DLINE=3
34# RUN: not llvm-ar -M < thin-save.mri 2>&1 | FileCheck --check-prefix=MULTIPLE %s -DLINE=3
35
36# MULTIPLE: error: script line [[LINE]]: editing multiple archives not supported
37
38#--- create.mri
39CREATE create.a
40SAVE
41
42#--- thin.mri
43CREATETHIN thin.a
44SAVE thin.mri
45
46#--- none.mri
47CREATE
48SAVE
49
50#--- thin-none.mri
51CREATETHIN
52SAVE
53
54#--- foo.txt
55FOO
56
57#--- none-add.mri
58CREATE
59ADDMOD foo.txt
60SAVE
61
62#--- thin-none-add.mri
63CREATETHIN
64ADDMOD foo.txt
65SAVE
66
67#--- path.mri
68CREATE path/path.a
69SAVE
70
71#--- thin-path.mri
72CREATETHIN path/thin-path.a
73SAVE
74
75#--- bad.mri
76CREATE bad/bad.a
77SAVE
78
79#--- thin-bad.mri
80CREATETHIN bad/bad.a
81SAVE
82
83#--- create2.mri
84CREATE create1.a
85CREATE create2.a
86SAVE
87
88#--- thin2.mri
89CREATETHIN thin1.a
90CREATETHIN thin2.a
91SAVE
92
93#--- mix1.mri
94CREATE mix1.a
95CREATETHIN mixthin1.a
96SAVE
97
98#--- mix2.mri
99CREATETHIN mixthin2.a
100CREATE mix2.a
101SAVE
102
103#--- save.mri
104CREATE create1.a
105SAVE
106CREATE create2.a
107SAVE
108
109#--- thin-save.mri
110CREATETHIN create1.a
111SAVE
112CREATETHIN create2.a
113SAVE
114