169 lines · plain
1# RUN: rm -rf %t && split-file %s %t2# RUN: cd %t3 4# RUN: yaml2obj %S/Inputs/elf.yaml -o elf.o5# RUN: llvm-ar -rc elf.a elf.o text.txt6# RUN: llvm-ar -rc --thin thin-elf.a elf.o text.txt7 8## Basic delete.9# RUN: llvm-ar -M < delete.mri10# RUN: llvm-ar tv delete.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o11 12# DELETE: text.txt13 14## Delete so the archive is empty.15# RUN: llvm-ar -M < empty.mri16# RUN: llvm-ar tv empty.ar | FileCheck %s --check-prefixes=EMPTY --allow-empty17 18# EMPTY-NOT: elf.o19 20## Attempt to delete a file that is not in the archive.21# RUN: llvm-ar -M < bad.mri22# RUN: llvm-ar tv bad.ar | FileCheck %s --check-prefixes=BOTH23 24## Delete operation in a script with comments.25# RUN: llvm-ar -M < comment.mri26# RUN: llvm-ar tv comment.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o27 28## Add a file that has been deleted.29# RUN: llvm-ar -M < re-add.mri30# RUN: llvm-ar tv re-add.ar | FileCheck %s --check-prefixes=BOTH31 32# BOTH-DAG: text.txt33# BOTH-DAG: elf.o34 35## Add the same file twice and delete them. It is expected behaviour36## that one delete command deletes all matching members.37# RUN: llvm-ar -M < duplicate.mri38# RUN: llvm-ar tv duplicate.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o39 40## Add and delete the same file twice.41# RUN: llvm-ar -M < duplicate-re-add.mri42# RUN: llvm-ar tv duplicate-re-add.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o43 44## Attempt to delete the same file twice.45# RUN: llvm-ar -M < extra-delete.mri46# RUN: llvm-ar tv extra-delete.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o47 48## Add the same file to a thin archive twice.49# RUN: llvm-ar -M < thin-duplicate.mri50# RUN: llvm-ar tv thin-duplicate.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o51 52## Delete a file after it was added via ADDLIB.53# RUN: llvm-ar -M < addlib.mri54# RUN: llvm-ar tv addlib.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o55 56## Attempt to delete an archive after it was added via ADDLIB.57# RUN: llvm-ar -M < addlib-deletelib.mri58# RUN: llvm-ar tv addlib-deletelib.ar | FileCheck %s --check-prefixes=BOTH59 60## Add the same archive twice to a thin archive and then delete some members.61# RUN: llvm-ar -M < addlib-thin-duplicate.mri62# RUN: llvm-ar tv addlib-thin-duplicate.ar | FileCheck %s --check-prefixes=DELETE --implicit-check-not=elf.o63 64#--- text.txt65I AM A TEXT FILE66 67#--- delete.mri68create delete.ar69addmod text.txt70addmod elf.o71delete elf.o72save73end74 75#--- empty.mri76create empty.ar77addmod elf.o78delete elf.o79save80end81 82#--- bad.mri83create bad.ar84addmod text.txt85addmod elf.o86delete bad.o87save88end89 90#--- comment.mri91create comment.ar92addmod elf.o93; comment94addmod text.txt95 ;comment96delete elf.o97* comment98save99 *comment100end101 102#--- re-add.mri103create re-add.ar104addmod elf.o105addmod text.txt106delete elf.o107addmod elf.o108save109end110 111#--- duplicate.mri112create duplicate.ar113addmod elf.o114addmod elf.o115addmod text.txt116delete elf.o117save118end119 120#--- duplicate-re-add.mri121create duplicate-re-add.ar122addmod elf.o123delete elf.o124addmod text.txt125addmod elf.o126delete elf.o127save128end129 130#--- extra-delete.mri131create extra-delete.ar132addmod elf.o133addmod text.txt134delete elf.o135delete elf.o136save137end138 139#--- thin-duplicate.mri140createthin thin-duplicate.ar141addmod elf.o142addmod elf.o143addmod text.txt144delete elf.o145save146end147 148#--- addlib.mri149create addlib.ar150addlib elf.a151delete elf.o152save153end154 155#--- addlib-deletelib.mri156create addlib-deletelib.ar157addlib elf.a158delete elf.a159save160end161 162#--- addlib-thin-duplicate.mri163createthin addlib-thin-duplicate.ar164addlib thin-elf.a165addlib thin-elf.a166delete elf.o167save168end169