xref: /llvm-project/llvm/test/tools/llvm-ar/mri-errors.test (revision 25040f8dec2e2dda5b0951744f9a32fb7aab3755)
1## Test different MRI comment formats and whitespace.
2
3# RUN: rm -rf %t && mkdir -p %t
4
5# RUN: echo "create %t/mri.ar" > %t/script1.mri
6# RUN: echo "addlib %t/missing.a" >> %t/script1.mri
7
8# RUN: not llvm-ar -M < %t/script1.mri 2>&1 | FileCheck --check-prefix=SCRIPT1 %s
9# SCRIPT1: error: script line 2: could not open library
10
11# RUN: echo "create %t/mri.ar" > %t/script2.mri
12# RUN: echo "addlib %t/bad.a" >> %t/script2.mri
13
14# RUN: echo "bad archive" > %t/bad.a
15
16# RUN: not llvm-ar -M < %t/script2.mri 2>&1 | FileCheck --check-prefix=SCRIPT2 %s
17# SCRIPT2: error: script line 2: could not parse library
18
19# RUN: echo "create %t/mri.ar" > %t/script3.mri
20# RUN: echo "create %t/second.ar" >> %t/script3.mri
21
22# RUN: not llvm-ar -M < %t/script3.mri 2>&1 | FileCheck --check-prefix=SCRIPT3 %s
23# SCRIPT3: error: script line 2: editing multiple archives not supported
24
25# RUN: echo "save" > %t/script4.mri
26# RUN: echo "create %t/mri.ar" >> %t/script4.mri
27
28# RUN: not llvm-ar -M < %t/script4.mri 2>&1 | FileCheck --check-prefix=SCRIPT4 %s
29# SCRIPT4: error: script line 2: file already saved
30
31# RUN: echo "create %t/mri.ar" > %t/script5.mri
32# RUN: echo "bad command" >> %t/script5.mri
33
34# RUN: not llvm-ar -M < %t/script5.mri 2>&1 | FileCheck --check-prefix=SCRIPT5 %s
35# SCRIPT5: error: script line 2: unknown command: bad
36
37# RUN: echo "bad command" | not llvm-ar -M 2>&1 | FileCheck --check-prefix=SCRIPT6 %s
38# SCRIPT6: error: script line 1: unknown command: bad
39
40# RUN: not llvm-ar -M rc %t/mri.ar 2>&1 | FileCheck --check-prefix=SCRIPT7 %s
41# SCRIPT7: error: cannot mix -M and other options
42