llvm/llvm/test/tools/llvm-ar/mri-thin-archive.test

# UNSUPPORTED: system-aix
# RUN: rm -rf %t && mkdir -p %t/addlib/ && split-file %s %t
# RUN: cd %t

# RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o
# RUN: cp %t/elf.o %t/addlib/elf.o
# RUN: cp %t/elf.o %t/delete.o

# RUN: llvm-ar rc --thin addlib/thin.ar addlib/elf.o
# RUN: llvm-ar rc addlib/regular.ar addlib/elf.o

# RUN: llvm-ar -M < thin.script
# RUN: FileCheck -input-file=archive.ar %s --check-prefixes=THIN --implicit-check-not=delete.o --match-full-lines

# THIN: !<thin>
# THIN: elf.o/
# THIN-NEXT: addlib/elf.o/

# RUN: llvm-ar -M < thin-to-regular.script
# RUN: FileCheck -input-file=regular.ar %s --check-prefixes=REGULAR

# REGULAR: !<arch>

# RUN: not llvm-ar -M < regular-to-thin.script 2>&1 | FileCheck %s --check-prefix=ERROR
# RUN: not ls thin.ar
# ERROR: error: script line 2: cannot add a regular archive's contents to a thin archive

#--- thin.script
createthin archive.ar
addmod elf.o
addlib addlib/thin.ar
addmod delete.o
delete delete.o
save
end

#--- thin-to-regular.script
create regular.ar
addlib addlib/thin.ar
save
end

#--- regular-to-thin.script
createthin thin.ar
addlib addlib/regular.ar
save
end