54 lines · plain
1## Test extract operation.2 3# RUN: rm -rf %t && mkdir -p %t/extracted/4 5## Extracting from an empty archive should not warn or error:6# RUN: llvm-ar cr --format=gnu %t/empty.a7# RUN: llvm-ar xv %t/empty.a 2>&1 | count 08 9# RUN: echo filea > %t/a.txt10# RUN: echo fileb > %t/b.txt11# RUN: llvm-ar rc --format=gnu %t/archive.a %t/a.txt %t/b.txt12 13## Single member:14# RUN: cd %t/extracted && llvm-ar xv %t/archive.a a.txt | FileCheck %s --check-prefix=A15# RUN: diff %t/a.txt %t/extracted/a.txt16# A: x - a.txt17 18## All members:19# RUN: rm %t/extracted/a.txt20# RUN: cd %t/extracted && llvm-ar xv %t/archive.a | FileCheck %s --check-prefix=AB21# RUN: diff %t/a.txt %t/extracted/a.txt22# RUN: diff %t/b.txt %t/extracted/b.txt23# AB: x - a.txt24# AB: x - b.txt25 26## Thin archive 27# RUN: llvm-ar Trc %t/thin-archive.a28# RUN: not llvm-ar x %t/thin-archive.a 2>&1 | FileCheck %s --check-prefix=THIN29# THIN: extracting from a thin archive is not supported30 31## No output if 'v' is not specified.32# RUN: rm a.txt b.txt33# RUN: llvm-ar x %t/archive.a 2>&1 | count 034# RUN: diff %t/a.txt %t/extracted/a.txt35# RUN: diff %t/b.txt %t/extracted/b.txt36 37## --output specifies the directory to extract archive members to. `1/2` is created by llvm-ar.38# RUN: llvm-ar --output=1/2 x %t/archive.a39# RUN: diff %t/a.txt %t/extracted/1/2/a.txt40# RUN: diff %t/b.txt %t/extracted/1/2/b.txt41 42## --output can be used with an absolute path and can be specified elsewhere on the command line.43# RUN: rm 1/2/a.txt44# RUN: llvm-ar xv %t/archive.a a.txt --output %t/extracted/1/2/../2 | FileCheck %s --check-prefix=OUTPUT-A45# RUN: diff %t/a.txt %t/extracted/1/2/a.txt46# OUTPUT-A: x - {{.*}}extracted{{.*}}a.txt47 48# RUN: not llvm-ar x --output=%t/a.txt %t/archive.a 2>&1 | FileCheck %s --check-prefix=OUTPUT-NOTDIR49# RUN: not llvm-ar x --output=%t/b.txt/a.txt %t/archive.a 2>&1 | FileCheck %s --check-prefix=OUTPUT-NOTDIR50# OUTPUT-NOTDIR: error: '{{.*}}a.txt' is not a directory51 52# RUN: not llvm-ar rc --output=1/2 %t/archive.a %t/a.txt 2>&1 | FileCheck %s --check-prefix=OUTPUT-ERR53# OUTPUT-ERR: error: --output is only applicable to the 'x' operation54