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 without member: 12# RUN: llvm-ar p %t/archive.a \ 13# RUN: | FileCheck %s --check-prefix=WITHOUT --match-full-lines --implicit-check-not {{.}} 14 15# WITHOUT: file1 16# WITHOUT-NEXT: file2 17# WITHOUT-NEXT: file3 18 19# RUN: llvm-ar pv %t/archive.a \ 20# RUN: | FileCheck %s --check-prefix=WITHOUT-VERBOSE --match-full-lines --implicit-check-not {{.}} 21 22# WITHOUT-VERBOSE: Printing 1.txt 23# WITHOUT-VERBOSE-NEXT: file1 24# WITHOUT-VERBOSE-NEXT: Printing 2.txt 25# WITHOUT-VERBOSE-NEXT: file2 26# WITHOUT-VERBOSE-NEXT: Printing 3.txt 27# WITHOUT-VERBOSE-NEXT: file3 28 29## Print single member: 30# RUN: llvm-ar p %t/archive.a %t/2.txt \ 31# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} 32 33# SINGLE: file2 34 35# RUN: llvm-ar pv %t/archive.a %t/2.txt \ 36# RUN: | FileCheck %s --check-prefix=SINGLE-VERBOSE --match-full-lines --implicit-check-not {{.}} 37 38# SINGLE-VERBOSE: Printing 2.txt 39# SINGLE-VERBOSE-NEXT: file2 40 41## Print multiple members: 42# RUN: llvm-ar p %t/archive.a %t/2.txt %t/1.txt \ 43# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}} 44 45# MULTIPLE: file1 46# MULTIPLE-NEXT: file2 47 48# RUN: llvm-ar pv %t/archive.a %t/2.txt %t/1.txt \ 49# RUN: | FileCheck %s --check-prefix=MULTIPLE-VERBOSE --match-full-lines --implicit-check-not {{.}} 50 51# MULTIPLE-VERBOSE: Printing 1.txt 52# MULTIPLE-VERBOSE-NEXT: file1 53# MULTIPLE-VERBOSE-NEXT: Printing 2.txt 54# MULTIPLE-VERBOSE-NEXT: file2 55 56## Print same member: 57# RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \ 58# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt 59 60# SAME-DAG: file2 61# SAME-DAG: error: '[[FILE]]' was not found 62 63## Print same member when containing multiple members with shared name: 64# llvm-ar -q %t/archive.a %t/2.txt 65# RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \ 66# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt 67 68## No archive: 69# RUN: not llvm-ar p 2>&1 \ 70# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE 71# 72# NO-ARCHIVE: error: an archive name must be specified 73 74## Archive does not exist: 75# RUN: not llvm-ar p %t/missing.a 2>&1 \ 76# RUN: | FileCheck %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a 77 78# MISSING-ARCHIVE: error: unable to load '[[ARCHIVE]]': {{[nN]}}o such file or directory 79 80## Member does not exist: 81# RUN: not llvm-ar p %t/archive.a %t-missing.txt 2>&1 \ 82# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t-missing.txt 83 84# MISSING-FILE: error: '[[FILE]]' was not found 85 86## Print thin archive: 87# RUN: llvm-ar Trc %t/thin-archive.a %t/1.txt %t/2.txt %t/3.txt 88# RUN: llvm-ar p %t/archive.a %t/2.txt \ 89# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} 90