1 ## Test that the replace command with "u" updates the relevant members.
3 # RUN: rm -rf %t && mkdir -p %t/new/other
5 # RUN: yaml2obj %s -o %t/1.o --docnum=1
6 # RUN: yaml2obj %s -o %t/2.o --docnum=2
7 # RUN: yaml2obj %s -o %t/3.o --docnum=3
9 # RUN: env TZ=GMT touch -t 200001020304 %t/1.o
10 # RUN: env TZ=GMT touch -t 200001020304 %t/2.o
11 # RUN: env TZ=GMT touch -t 200001020304 %t/3.o
13 # RUN: yaml2obj %s -o %t/new/1.o --docnum=4
14 # RUN: yaml2obj %s -o %t/new/3.o --docnum=5
16 # RUN: yaml2obj %s -o %t/new/other/1.o --docnum=6
18 # RUN: env TZ=GMT touch -t 200001020304 %t/new/other/1.o
20 ## Replace single member with newer file:
21 # RUN: llvm-ar rcU %t/single.a %t/1.o %t/2.o %t/3.o
22 # RUN: llvm-ar ruU %t/single.a %t/new/1.o
23 # RUN: llvm-ar t %t/single.a \
24 # RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}}
30 # RUN: llvm-nm --print-armap %t/single.a \
31 # RUN: | FileCheck %s --check-prefix=SINGLE-SYM
33 # SINGLE-SYM: symbolnew1
34 # SINGLE-SYM-NEXT: symbol2
35 # SINGLE-SYM-NEXT: symbol3
37 ## Replace new single member with older file:
38 # RUN: llvm-ar ruU %t/single.a %t/1.o
39 # RUN: llvm-ar t %t/single.a \
40 # RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}}
42 # RUN: llvm-nm --print-armap %t/single.a \
43 # RUN: | FileCheck %s --check-prefix=SINGLE-SYM
45 ## Replace multiple members with newer files:
46 # RUN: llvm-ar rcuU %t/multiple.a %t/1.o %t/2.o %t/3.o
47 # RUN: llvm-ar ruU %t/multiple.a %t/new/1.o %t/new/3.o
48 # RUN: llvm-ar t %t/multiple.a \
49 # RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
55 # RUN: llvm-nm --print-armap %t/multiple.a \
56 # RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
58 # MULTIPLE-SYM: symbolnew1
59 # MULTIPLE-SYM-NEXT: symbol2
60 # MULTIPLE-SYM-NEXTs: symbolnew3
62 ## Replace newer members with multiple older files:
63 # RUN: llvm-ar ruU %t/multiple.a %t/1.o %t/2.o
64 # RUN: llvm-ar t %t/multiple.a \
65 # RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
67 # RUN: llvm-nm --print-armap %t/multiple.a \
68 # RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
70 ## Replace same member with newer files:
71 # RUN: llvm-ar rcuU %t/same.a %t/1.o %t/2.o %t/3.o
72 # RUN: llvm-ar ruU %t/same.a %t/new/1.o %t/new/other/1.o
73 # RUN: llvm-ar t %t/same.a \
74 # RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --implicit-check-not {{.}}
81 # RUN: llvm-nm --print-armap %t/same.a \
82 # RUN: | FileCheck %s --check-prefix=SAME-SYM
84 # SAME-SYM: symbolnew1
85 # SAME-SYM-NEXT: symbol2
86 # SAME-SYM-NEXT: symbol3
87 # SAME-SYM-NEXT: symbolother1
89 ## Replace multiple members with an older file and a newer file:
90 # RUN: llvm-ar rcuU %t/old-new.a %t/new/1.o %t/2.o %t/3.o
91 # RUN: llvm-ar ruU %t/old-new.a %t/1.o %t/new/3.o
92 # RUN: llvm-ar t %t/old-new.a \
93 # RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
95 # RUN: llvm-nm --print-armap %t/old-new.a \
96 # RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
98 ## Replace same member with an older file and a newer file:
99 # RUN: llvm-ar rcuU %t/old-new-same.a %t/new/1.o %t/2.o %t/3.o
100 # RUN: llvm-ar ruU %t/old-new-same.a %t/1.o %t/new/other/1.o
101 # RUN: llvm-ar t %t/old-new-same.a \
102 # RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --implicit-check-not {{.}}
104 # RUN: llvm-nm --print-armap %t/same.a \
105 # RUN: | FileCheck %s --check-prefix=SAME-SYM