1## Test Print output 2# XFAIL: system-darwin 3 4# RUN: rm -rf %t && mkdir -p %t 5# RUN: echo file1 > %t/1.txt 6# RUN: echo file2 > %t/2.txt 7# RUN: echo file3 > %t/3.txt 8 9# RUN: llvm-ar -rc %t/archive.a %t/1.txt %t/2.txt %t/3.txt 10 11## Print empty archive: 12# RUN: llvm-ar --format=gnu cr %t/empty.a 13# RUN: llvm-ar p %t/empty.a 2>&1 | count 0 14# RUN: llvm-ar pv %t/empty.a 2>&1 | count 0 15 16## Print without member: 17# RUN: llvm-ar p %t/archive.a \ 18# RUN: | FileCheck %s --check-prefix=WITHOUT --match-full-lines --implicit-check-not {{.}} 19 20# WITHOUT: file1 21# WITHOUT-NEXT: file2 22# WITHOUT-NEXT: file3 23 24# RUN: llvm-ar pv %t/archive.a \ 25# RUN: | FileCheck %s --check-prefix=WITHOUT-VERBOSE --match-full-lines --implicit-check-not {{.}} 26 27# WITHOUT-VERBOSE: Printing 1.txt 28# WITHOUT-VERBOSE-NEXT: file1 29# WITHOUT-VERBOSE-NEXT: Printing 2.txt 30# WITHOUT-VERBOSE-NEXT: file2 31# WITHOUT-VERBOSE-NEXT: Printing 3.txt 32# WITHOUT-VERBOSE-NEXT: file3 33 34## Print single member: 35# RUN: llvm-ar p %t/archive.a %t/2.txt \ 36# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} 37 38# SINGLE: file2 39 40# RUN: llvm-ar pv %t/archive.a %t/2.txt \ 41# RUN: | FileCheck %s --check-prefix=SINGLE-VERBOSE --match-full-lines --implicit-check-not {{.}} 42 43# SINGLE-VERBOSE: Printing 2.txt 44# SINGLE-VERBOSE-NEXT: file2 45 46## Print multiple members: 47# RUN: llvm-ar p %t/archive.a %t/2.txt %t/1.txt \ 48# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}} 49 50# MULTIPLE: file1 51# MULTIPLE-NEXT: file2 52 53# RUN: llvm-ar pv %t/archive.a %t/2.txt %t/1.txt \ 54# RUN: | FileCheck %s --check-prefix=MULTIPLE-VERBOSE --match-full-lines --implicit-check-not {{.}} 55 56# MULTIPLE-VERBOSE: Printing 1.txt 57# MULTIPLE-VERBOSE-NEXT: file1 58# MULTIPLE-VERBOSE-NEXT: Printing 2.txt 59# MULTIPLE-VERBOSE-NEXT: file2 60 61## Print same member: 62# RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \ 63# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt 64 65# SAME-DAG: file2 66# SAME-DAG: error: '[[FILE]]' was not found 67 68## Print same member when containing multiple members with shared name: 69# llvm-ar -q %t/archive.a %t/2.txt 70# RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \ 71# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt 72 73## No archive: 74# RUN: not llvm-ar p 2>&1 \ 75# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE 76# 77# NO-ARCHIVE: error: an archive name must be specified 78 79## Archive does not exist: 80# RUN: not llvm-ar p %t/missing.a 2>&1 \ 81# RUN: | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a 82 83# MISSING-ARCHIVE: error: unable to load '[[ARCHIVE]]': [[MSG]] 84 85## Member does not exist: 86# RUN: not llvm-ar p %t/archive.a %t-missing.txt 2>&1 \ 87# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t-missing.txt 88 89# MISSING-FILE: error: '[[FILE]]' was not found 90 91## Print empty thin archive: 92# RUN: llvm-ar Trc %t/thin-archive-empty.a 93# RUN: llvm-ar p %t/thin-archive-empty.a 2>&1 | count 0 94# RUN: llvm-ar pv %t/thin-archive-empty.a 2>&1 | count 0 95 96## Print thin archive: 97# RUN: llvm-ar Trc %t/thin-archive.a %t/1.txt %t/2.txt %t/3.txt 98# RUN: llvm-ar p %t/archive.a %t/2.txt \ 99# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} 100