83 lines · plain
1## Test the ADDLIB MRI command.2 3# RUN: rm -rf %t && split-file %s %t4# RUN: cd %t5# RUN: yaml2obj %s -o f.o6# RUN: llvm-ar r f.a f.o7 8## Merge contents of archives.9# RUN: llvm-ar -M < add-lib.mri10# RUN: llvm-nm --print-armap add-lib.a | FileCheck --check-prefix=SYMS %s11# RUN: llvm-ar t add-lib.a | FileCheck --check-prefix=FILES %s12 13# SYMS: f in {{.*}}14# FILES: f.o15 16## ADDLIB with non-archive file.17# RUN: not llvm-ar -M < bad-lib.mri 2>&1 | FileCheck --check-prefix=PARSE %s18# RUN: not ls bad-lib.a19 20# PARSE: error: script line 2: could not parse library21 22## No create command.23# RUN: not llvm-ar -M < no-create.mri 2>&1 | FileCheck --check-prefix=NOCREATE %s24 25# NOCREATE: error: script line 1: no output archive has been opened26 27## ADDLIB with missing file.28# RUN: not llvm-ar -M < missing.mri 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=MISSING29# RUN: not ls missing.a30 31# MISSING: error: script line 2: could not open library missing-lib.a: [[MSG]]32 33## ADD same lib twice.34# RUN: llvm-ar -M < duplicate.mri35# RUN: llvm-nm --print-armap duplicate.a | FileCheck --check-prefix=SYMS2 %s36# RUN: llvm-ar t duplicate.a | FileCheck --check-prefix=FILES2 %s37 38# SYMS2-COUNT-2: f in {{.*}}39# FILES2-COUNT-2: f.o40 41#--- f.yaml42--- !ELF43FileHeader:44 Class: ELFCLASS6445 Data: ELFDATA2LSB46 Type: ET_REL47 Machine: EM_X86_6448Sections:49 - Name: .text50 Type: SHT_PROGBITS51Symbols:52 - Name: f53 Binding: STB_GLOBAL54 Section: .text55...56#--- add-lib.mri57CREATE add-lib.a58ADDLIB f.a59SAVE60 61#--- text.txt62I AM NOT AN ARCHIVE63 64#--- bad-lib.mri65CREATE bad-lib.a66ADDLIB text.txt67SAVE68 69#--- no-create.mri70ADDLIB f.a71SAVE72 73#--- missing.mri74CREATE missing.a75ADDLIB missing-lib.a76SAVE77 78#--- duplicate.mri79CREATE duplicate.a80ADDLIB f.a81ADDLIB f.a82SAVE83