• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Test moving files after a file.
2
3RUN: touch %t1.txt
4RUN: touch %t2.txt
5RUN: touch %t3.txt
6RUN: touch %t4.txt
7
8# Move one file:
9RUN: rm -f %t-one.a
10RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt %t3.txt
11RUN: llvm-ar mb %t2.txt %t-one.a %t3.txt
12RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE
13
14ONE:      1.txt
15ONE-NEXT: 3.txt
16ONE-NEXT: 2.txt
17
18# Move file to front:
19RUN: rm -f %t-front.a
20RUN: llvm-ar rc %t-front.a %t1.txt %t2.txt %t3.txt
21RUN: llvm-ar mb %t1.txt %t-front.a %t3.txt
22RUN: llvm-ar t %t-front.a | FileCheck %s --check-prefix=FRONT
23
24FRONT:      3.txt
25FRONT-NEXT: 1.txt
26FRONT-NEXT: 2.txt
27
28# Move multiple files:
29RUN: rm -f %t-multiple.a
30RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt %t3.txt %t4.txt
31RUN: llvm-ar mb %t2.txt %t-multiple.a %t4.txt %t3.txt
32RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE
33
34MULTIPLE:      1.txt
35MULTIPLE-NEXT: 3.txt
36MULTIPLE-NEXT: 4.txt
37MULTIPLE-NEXT: 2.txt
38
39# Move before invalid file:
40RUN: rm -f %t-invalid.a
41RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt
42RUN: not llvm-ar mb invalid.txt %t-invalid.a %t2.txt 2>&1 \
43RUN:   | FileCheck %s --check-prefix=ERROR
44RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID
45
46ERROR: error: insertion point not found
47INVALID:      1.txt
48INVALID-NEXT: 2.txt
49INVALID-NEXT: 3.txt
50
51# Move file to the same position:
52RUN: rm -f %t-position.a
53RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt
54RUN: llvm-ar mb %t3.txt %t-position.a %t2.txt
55RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION
56
57POSITION:      1.txt
58POSITION-NEXT: 2.txt
59POSITION-NEXT: 3.txt
60
61# Move file after itself:
62RUN: rm -f %t-same.a
63RUN: llvm-ar rc %t-same.a %t1.txt %t2.txt %t3.txt
64RUN: llvm-ar mb %t2.txt %t-same.a %t2.txt
65RUN: llvm-ar t %t-same.a | FileCheck %s --check-prefix=SAME
66
67SAME:      1.txt
68SAME-NEXT: 2.txt
69SAME-NEXT: 3.txt
70