summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-ar/mri-addlib.test
diff options
context:
space:
mode:
authorOwen Reynolds <gbreynoo@gmail.com>2019-07-03 13:47:29 +0000
committerOwen Reynolds <gbreynoo@gmail.com>2019-07-03 13:47:29 +0000
commit250015bacf7f255abcfb646fb8b6b56ce8be7e01 (patch)
tree1b84011671268874e5ac1d77bfa6fa5700d5a7c8 /llvm/test/tools/llvm-ar/mri-addlib.test
parent1665dd63466b6d284c75c3543e3fdb19314d752f (diff)
downloadbcm5719-llvm-250015bacf7f255abcfb646fb8b6b56ce8be7e01.tar.gz
bcm5719-llvm-250015bacf7f255abcfb646fb8b6b56ce8be7e01.zip
[llvm-ar][test] Add to MRI test coverage
This reapplies 363232 that was reverted due to a buildbot test failure, this build bot has now been fixed. Differential Revision: https://reviews.llvm.org/D63197 llvm-svn: 365039
Diffstat (limited to 'llvm/test/tools/llvm-ar/mri-addlib.test')
-rw-r--r--llvm/test/tools/llvm-ar/mri-addlib.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-ar/mri-addlib.test b/llvm/test/tools/llvm-ar/mri-addlib.test
new file mode 100644
index 00000000000..c297653e2ab
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/mri-addlib.test
@@ -0,0 +1,45 @@
+## Test the ADDLIB MRI command.
+
+# RUN: rm -rf %t && mkdir -p %t
+# RUN: yaml2obj %s -o %t/f.o
+# RUN: llvm-ar r %t/f.a %t/f.o
+
+## Merge contents of archives.
+# RUN: echo "CREATE %t/addlib.a" > %t/addlib.mri
+# RUN: echo "ADDLIB %t/f.a" >> %t/addlib.mri
+# RUN: echo "SAVE" >> %t/addlib.mri
+# RUN: llvm-ar -M < %t/addlib.mri
+# RUN: llvm-nm --print-armap %t/addlib.a | FileCheck --check-prefix=SYMS %s
+# RUN: llvm-ar t %t/addlib.a | FileCheck --check-prefix=FILES %s
+
+# SYMS: f in {{.*}}
+# FILES: f.o
+
+## ADDLIB with non-archive file.
+# RUN: echo "CREATE %t/badlib.a" > %t/badlib.mri
+# RUN: echo "ADDLIB %s" >> %t/badlib.mri
+# RUN: echo "SAVE" >> %t/badlib.mri
+# RUN: not llvm-ar -M < %t/badlib.mri 2>&1 | FileCheck --check-prefix=PARSE %s
+# RUN: not ls %t/badlib.a
+
+# PARSE: Could not parse library
+
+## No create command.
+# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri
+# RUN: echo "SAVE" >> %t/nocreate.mri
+# RUN: not llvm-ar -M < %t/nocreate.mri
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+Symbols:
+ - Name: f
+ Binding: STB_GLOBAL
+ Section: .text
+...
OpenPOWER on IntegriCloud