130 lines · plain
1## Test the move command without modifiers moves members to the end2 3# RUN: rm -rf %t && mkdir -p %t4# RUN: yaml2obj %s -o %t/1.o --docnum=15# RUN: yaml2obj %s -o %t/2.o --docnum=26# RUN: yaml2obj %s -o %t/3.o --docnum=37 8## Move single member:9# RUN: llvm-ar rc %t/single.a %t/1.o %t/2.o %t/3.o10# RUN: llvm-ar m %t/single.a %t/1.o11# RUN: llvm-ar t %t/single.a \12# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}13 14# SINGLE: 2.o15# SINGLE-NEXT: 3.o16# SINGLE-NEXT: 1.o17 18# RUN: llvm-nm --print-armap %t/single.a \19# RUN: | FileCheck %s --check-prefix=SINGLE-SYM20 21# SINGLE-SYM: symbol222# SINGLE-SYM-NEXT: symbol323# SINGLE-SYM-NEXT: symbol124 25## Move multiple members:26# RUN: llvm-ar rc %t/multiple.a %t/1.o %t/2.o %t/3.o27# RUN: llvm-ar m %t/multiple.a %t/1.o %t/2.o28# RUN: llvm-ar t %t/multiple.a \29# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}30 31# MULTIPLE: 3.o32# MULTIPLE-NEXT: 1.o33# MULTIPLE-NEXT: 2.o34 35# RUN: llvm-nm --print-armap %t/multiple.a \36# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM37 38# MULTIPLE-SYM: symbol339# MULTIPLE-SYM-NEXT: symbol140# MULTIPLE-SYM-NEXT: symbol241 42## Move same member:43# RUN: llvm-ar rc %t/same.a %t/1.o %t/2.o %t/3.o44# RUN: llvm-ar m %t/same.a %t/1.o %t/1.o45# RUN: llvm-ar t %t/same.a \46# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o47 48# SAME: 2.o49# SAME-NEXT: 3.o50# SAME-NEXT: 1.o51 52# RUN: llvm-nm --print-armap %t/same.a \53# RUN: | FileCheck %s --check-prefix=SAME-SYM54 55# SAME-SYM: symbol256# SAME-SYM-NEXT: symbol357# SAME-SYM-NEXT: symbol158 59## Move without member:60# RUN: llvm-ar rc %t/without.a %t/1.o %t/2.o %t/3.o61# RUN: llvm-ar m %t/without.a62# RUN: llvm-ar t %t/without.a \63# RUN: | FileCheck %s --match-full-lines --check-prefix=WITHOUT --implicit-check-not {{.}}64 65# WITHOUT: 1.o66# WITHOUT-NEXT: 2.o67# WITHOUT-NEXT: 3.o68 69# RUN: llvm-nm --print-armap %t/without.a \70# RUN: | FileCheck %s --check-prefix=WITHOUT-SYM71 72# WITHOUT-SYM: symbol173# WITHOUT-SYM-NEXT: symbol274# WITHOUT-SYM-NEXT: symbol375 76## No archive:77# RUN: not llvm-ar m 2>&1 \78# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE79 80# NO-ARCHIVE: error: an archive name must be specified81 82## Member does not exist:83# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o84# RUN: not llvm-ar m %t/missing.a %t/missing.txt 2>&1 \85# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt -DMSG=%errc_ENOENT86 87# MISSING-FILE: error: [[FILE]]: [[MSG]]88 89--- !ELF90FileHeader:91 Class: ELFCLASS6492 Data: ELFDATA2LSB93 Type: ET_REL94 Machine: EM_X86_6495Sections:96 - Name: .text97 Type: SHT_PROGBITS98Symbols:99 - Name: symbol1100 Binding: STB_GLOBAL101 Section: .text102 103--- !ELF104FileHeader:105 Class: ELFCLASS64106 Data: ELFDATA2LSB107 Type: ET_REL108 Machine: EM_X86_64109Sections:110 - Name: .text111 Type: SHT_PROGBITS112Symbols:113 - Name: symbol2114 Binding: STB_GLOBAL115 Section: .text116 117--- !ELF118FileHeader:119 Class: ELFCLASS64120 Data: ELFDATA2LSB121 Type: ET_REL122 Machine: EM_X86_64123Sections:124 - Name: .text125 Type: SHT_PROGBITS126Symbols:127 - Name: symbol3128 Binding: STB_GLOBAL129 Section: .text130