brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · fa6141f Raw
81 lines · plain
1# Test the 'N' count parameter.2 3# Get a temp clean cwd to extract into.4RUN: rm -rf %t && mkdir -p %t && cd %t5 6RUN: mkdir -p %t/x %t/y %t/z7RUN: echo hello > %t/x/foo.txt8RUN: echo cool  > %t/y/foo.txt9RUN: echo world > %t/z/foo.txt10RUN: echo fizz   > %t/x/bar.txt11RUN: echo buzz   > %t/y/bar.txt12RUN: echo fizbuz > %t/z/bar.txt13RUN: llvm-ar rc %t/archive.a %t/x/foo.txt %t/y/foo.txt %t/z/foo.txt \14RUN:     %t/x/bar.txt %t/y/bar.txt %t/z/bar.txt15RUN: llvm-ar t %t/archive.a | FileCheck %s --check-prefix=LIST-MEMBERS16 17# Make sure we set it up correctly.18LIST-MEMBERS:      foo.txt19LIST-MEMBERS-NEXT: foo.txt20LIST-MEMBERS-NEXT: foo.txt21LIST-MEMBERS-NEXT: bar.txt22LIST-MEMBERS-NEXT: bar.txt23LIST-MEMBERS-NEXT: bar.txt24 25# Must be a number.26RUN: not llvm-ar xN abc %t/archive.a foo.txt 2>&1 | FileCheck %s --check-prefix=ERR-NOT-NUM27RUN: not llvm-ar xN 0x1 %t/archive.a foo.txt 2>&1 | FileCheck %s --check-prefix=ERR-NOT-NUM28# Only three members named foo, so 1 <= N <= 3.29RUN: not llvm-ar xN 0 %t/archive.a foo.txt 2>&1 | FileCheck %s --check-prefix=ERR-NOT-POS30RUN: not llvm-ar xN 4 %t/archive.a foo.txt 2>&1 | FileCheck %s --check-prefix=ERR-NOT-FOUND31# N only applies to x/d.32RUN: not llvm-ar rN 1 %t/archive.a foo.txt 2>&1 | FileCheck %s --check-prefix=ERR-BAD-OP33 34ERR-NOT-NUM:   error: value for [count] must be numeric35ERR-NOT-POS:   error: value for [count] must be positive36ERR-BAD-OP:    error: the 'N' modifier can only be specified with the 'x' or 'd' operations37ERR-NOT-FOUND: error: 'foo.txt' was not found38 39# Extract individual items.40 41RUN: rm -f foo.txt bar.txt42RUN: llvm-ar xN 1 %t/archive.a foo.txt bar.txt43RUN: cat %t/foo.txt | FileCheck %s --check-prefix=FOO-144RUN: cat %t/bar.txt | FileCheck %s --check-prefix=BAR-145 46RUN: rm -f foo.txt bar.txt47RUN: llvm-ar xN 2 %t/archive.a foo.txt bar.txt48RUN: cat %t/foo.txt | FileCheck %s --check-prefix=FOO-249RUN: cat %t/bar.txt | FileCheck %s --check-prefix=BAR-250 51RUN: rm -f foo.txt bar.txt52RUN: llvm-ar xN 3 %t/archive.a foo.txt bar.txt53RUN: cat %t/foo.txt | FileCheck %s --check-prefix=FOO-354RUN: cat %t/bar.txt | FileCheck %s --check-prefix=BAR-355 56# Delete individual items.57 58# Deleting the second member named foo means the new second member of the59# archive is what used to be the third element.60RUN: rm -f foo.txt bar.txt61RUN: llvm-ar dN 2 %t/archive.a foo.txt62RUN: llvm-ar xN 2 %t/archive.a foo.txt bar.txt63RUN: cat %t/foo.txt | FileCheck %s --check-prefix=FOO-364RUN: cat %t/bar.txt | FileCheck %s --check-prefix=BAR-265 66# Deleting the first member from *both* archives means the new first member67# named foo is the what used to be the third member, and the new first member68# named bar is what used to be the second member.69RUN: rm -f foo.txt bar.txt70RUN: llvm-ar dN 1 %t/archive.a foo.txt bar.txt71RUN: llvm-ar xN 1 %t/archive.a foo.txt bar.txt72RUN: cat %t/foo.txt | FileCheck %s --check-prefix=FOO-373RUN: cat %t/bar.txt | FileCheck %s --check-prefix=BAR-274 75FOO-1: hello76FOO-2: cool77FOO-3: world78BAR-1: fizz79BAR-2: buzz80BAR-3: fizbuz81