diff options
-rw-r--r-- | llvm/test/tools/llvm-ar/create.test | 27 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/dash-before-letter.test | 24 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/delete.test | 134 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/insert-after.test | 118 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/insert-before.test | 118 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/move-after.test | 118 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/move-before.test | 138 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/move.test | 258 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/mri-addlib.test | 90 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/mri-addmod.test | 54 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/mri-comments.test | 38 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/mri-end.test | 96 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/quick-append.test | 184 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/read-only-archive.test | 60 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/replace-update.test | 378 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/replace.test | 356 | ||||
-rw-r--r-- | llvm/test/tools/llvm-ar/symtab.test | 140 |
17 files changed, 1164 insertions, 1167 deletions
diff --git a/llvm/test/tools/llvm-ar/create.test b/llvm/test/tools/llvm-ar/create.test index 7e4951da5fa..a29b93ec5d6 100644 --- a/llvm/test/tools/llvm-ar/create.test +++ b/llvm/test/tools/llvm-ar/create.test @@ -1,14 +1,13 @@ -## Test the creation warning and supression of that warning.
-
-RUN: touch %t1.txt
-RUN: touch %t2.txt
-
-RUN: rm -f %t.warning.ar
-RUN: llvm-ar r %t.warning.ar %t1.txt %t2.txt 2>&1 \
-RUN: | FileCheck %s -DOUTPUT=%t.warning.ar
-
-CHECK: warning: creating [[OUTPUT]]
-
-RUN: rm -f %t.supressed.ar
-RUN: llvm-ar cr %t.supressed.ar %t1.txt %t2.txt 2>&1 \
-RUN: | FileCheck --allow-empty /dev/null --implicit-check-not={{.}}
+## Test the creation warning and supression of that warning. + +RUN: touch %t1.txt +RUN: touch %t2.txt + +RUN: rm -f %t.warning.ar +RUN: llvm-ar r %t.warning.ar %t1.txt %t2.txt 2>&1 \ +RUN: | FileCheck %s -DOUTPUT=%t.warning.ar + +CHECK: warning: creating [[OUTPUT]] + +RUN: rm -f %t.supressed.ar +RUN: llvm-ar cr %t.supressed.ar %t1.txt %t2.txt 2>&1 | count 0 diff --git a/llvm/test/tools/llvm-ar/dash-before-letter.test b/llvm/test/tools/llvm-ar/dash-before-letter.test index 3002a6de7ef..43930b12173 100644 --- a/llvm/test/tools/llvm-ar/dash-before-letter.test +++ b/llvm/test/tools/llvm-ar/dash-before-letter.test @@ -1,12 +1,12 @@ -# Test the use of dash before key letters.
-
-RUN: touch %t1.txt
-RUN: touch %t2.txt
-
-RUN: rm -f %t.ar
-RUN: llvm-ar s -cr %t.ar %t1.txt
-RUN: llvm-ar -r -s %t.ar %t2.txt -s
-RUN: llvm-ar -t %t.ar | FileCheck %s
-
-CHECK: 1.txt
-CHECK-NEXT: 2.txt
+# Test the use of dash before key letters. + +RUN: touch %t1.txt +RUN: touch %t2.txt + +RUN: rm -f %t.ar +RUN: llvm-ar s -cr %t.ar %t1.txt +RUN: llvm-ar -r -s %t.ar %t2.txt -s +RUN: llvm-ar -t %t.ar | FileCheck %s + +CHECK: 1.txt +CHECK-NEXT: 2.txt diff --git a/llvm/test/tools/llvm-ar/delete.test b/llvm/test/tools/llvm-ar/delete.test index d5ab7976641..20e58b9a45b 100644 --- a/llvm/test/tools/llvm-ar/delete.test +++ b/llvm/test/tools/llvm-ar/delete.test @@ -1,67 +1,67 @@ -## Test the deletion of members and that symbols are removed from the symbol table.
-
-# RUN: yaml2obj %s -o %t-delete.o --docnum=1
-# RUN: yaml2obj %s -o %t-keep.o --docnum=2
-# RUN: touch %t1.txt
-# RUN: touch %t2.txt
-
-## Add file:
-# RUN: rm -f %t.a
-# RUN: llvm-ar rc %t.a %t1.txt %t-delete.o %t-keep.o %t2.txt
-# RUN: llvm-nm --print-armap %t.a \
-# RUN: | FileCheck %s --check-prefix=SYMBOL-ADDED
-# RUN: llvm-ar t %t.a | FileCheck %s --check-prefix=FILE-ADDED
-
-# SYMBOL-ADDED: symbol1
-# SYMBOL-ADDED-NEXT: symbol2
-
-# FILE-ADDED: 1.txt
-# FILE-ADDED-NEXT: delete.o
-# FILE-ADDED-NEXT: keep.o
-# FILE-ADDED-NEXT: 2.txt
-
-## Delete file that is not a member:
-# RUN: cp %t.a %t-archive-copy.a
-# RUN: llvm-ar d %t.a t/missing.o
-# RUN: cmp %t.a %t-archive-copy.a
-
-## Delete file:
-# RUN: llvm-ar d %t.a %t-delete.o
-# RUN: llvm-nm --print-armap %t.a \
-# RUN: | FileCheck %s --check-prefix=SYMBOL-DELETED --implicit-check-not symbol1
-# RUN: llvm-ar t %t.a \
-# RUN: | FileCheck %s --check-prefix=FILE-DELETED --implicit-check-not delete.o
-
-# SYMBOL-DELETED: symbol2
-
-# FILE-DELETED: 1.txt
-# FILE-DELETED-NEXT: keep.o
-# FILE-DELETED-NEXT: 2.txt
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol2
- Binding: STB_GLOBAL
- Section: .text
+## Test the deletion of members and that symbols are removed from the symbol table. + +# RUN: yaml2obj %s -o %t-delete.o --docnum=1 +# RUN: yaml2obj %s -o %t-keep.o --docnum=2 +# RUN: touch %t1.txt +# RUN: touch %t2.txt + +## Add file: +# RUN: rm -f %t.a +# RUN: llvm-ar rc %t.a %t1.txt %t-delete.o %t-keep.o %t2.txt +# RUN: llvm-nm --print-armap %t.a \ +# RUN: | FileCheck %s --check-prefix=SYMBOL-ADDED +# RUN: llvm-ar t %t.a | FileCheck %s --check-prefix=FILE-ADDED + +# SYMBOL-ADDED: symbol1 +# SYMBOL-ADDED-NEXT: symbol2 + +# FILE-ADDED: 1.txt +# FILE-ADDED-NEXT: delete.o +# FILE-ADDED-NEXT: keep.o +# FILE-ADDED-NEXT: 2.txt + +## Delete file that is not a member: +# RUN: cp %t.a %t-archive-copy.a +# RUN: llvm-ar d %t.a t/missing.o +# RUN: cmp %t.a %t-archive-copy.a + +## Delete file: +# RUN: llvm-ar d %t.a %t-delete.o +# RUN: llvm-nm --print-armap %t.a \ +# RUN: | FileCheck %s --check-prefix=SYMBOL-DELETED --implicit-check-not symbol1 +# RUN: llvm-ar t %t.a \ +# RUN: | FileCheck %s --check-prefix=FILE-DELETED --implicit-check-not delete.o + +# SYMBOL-DELETED: symbol2 + +# FILE-DELETED: 1.txt +# FILE-DELETED-NEXT: keep.o +# FILE-DELETED-NEXT: 2.txt + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol2 + Binding: STB_GLOBAL + Section: .text diff --git a/llvm/test/tools/llvm-ar/insert-after.test b/llvm/test/tools/llvm-ar/insert-after.test index cd8ee9409c6..7c01e736149 100644 --- a/llvm/test/tools/llvm-ar/insert-after.test +++ b/llvm/test/tools/llvm-ar/insert-after.test @@ -1,59 +1,59 @@ -## Test inserting files after a file.
-
-RUN: touch %t1.txt
-RUN: touch %t2.txt
-RUN: touch %t3.txt
-RUN: touch %t4.txt
-
-# Insert one file:
-RUN: rm -f %t-one.a
-RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt
-RUN: llvm-ar ra %t1.txt %t-one.a %t3.txt
-RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE
-
-ONE: 1.txt
-ONE-NEXT: 3.txt
-ONE-NEXT: 2.txt
-
-# Insert file at back:
-RUN: rm -f %t-back.a
-RUN: llvm-ar rc %t-back.a %t1.txt %t2.txt
-RUN: llvm-ar ra %t2.txt %t-back.a %t3.txt
-RUN: llvm-ar t %t-back.a | FileCheck %s --check-prefix=BACK
-
-BACK: 1.txt
-BACK-NEXT: 2.txt
-BACK-NEXT: 3.txt
-
-# Insert multiple files:
-RUN: rm -f %t-multiple.a
-RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt
-RUN: llvm-ar ra %t1.txt %t-multiple.a %t4.txt %t3.txt
-RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE
-
-MULTIPLE: 1.txt
-MULTIPLE-NEXT: 4.txt
-MULTIPLE-NEXT: 3.txt
-MULTIPLE-NEXT: 2.txt
-
-# Insert after invalid file:
-RUN: rm -f %t-invalid.a
-RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt
-RUN: not llvm-ar ra invalid.txt %t-invalid.a %t2.txt 2>&1 \
-RUN: | FileCheck %s --check-prefix=ERROR
-RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID
-
-ERROR: error: Insertion point not found.
-INVALID: 1.txt
-INVALID-NEXT: 2.txt
-INVALID-NEXT: 3.txt
-
-# Insert file at the same position:
-RUN: rm -f %t-position.a
-RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar ra %t1.txt %t-position.a %t2.txt
-RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION
-
-POSITION: 1.txt
-POSITION-NEXT: 2.txt
-POSITION-NEXT: 3.txt
+## Test inserting files after a file. + +RUN: touch %t1.txt +RUN: touch %t2.txt +RUN: touch %t3.txt +RUN: touch %t4.txt + +# Insert one file: +RUN: rm -f %t-one.a +RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt +RUN: llvm-ar ra %t1.txt %t-one.a %t3.txt +RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE + +ONE: 1.txt +ONE-NEXT: 3.txt +ONE-NEXT: 2.txt + +# Insert file at back: +RUN: rm -f %t-back.a +RUN: llvm-ar rc %t-back.a %t1.txt %t2.txt +RUN: llvm-ar ra %t2.txt %t-back.a %t3.txt +RUN: llvm-ar t %t-back.a | FileCheck %s --check-prefix=BACK + +BACK: 1.txt +BACK-NEXT: 2.txt +BACK-NEXT: 3.txt + +# Insert multiple files: +RUN: rm -f %t-multiple.a +RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt +RUN: llvm-ar ra %t1.txt %t-multiple.a %t4.txt %t3.txt +RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE + +MULTIPLE: 1.txt +MULTIPLE-NEXT: 4.txt +MULTIPLE-NEXT: 3.txt +MULTIPLE-NEXT: 2.txt + +# Insert after invalid file: +RUN: rm -f %t-invalid.a +RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt +RUN: not llvm-ar ra invalid.txt %t-invalid.a %t2.txt 2>&1 \ +RUN: | FileCheck %s --check-prefix=ERROR +RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID + +ERROR: error: Insertion point not found. +INVALID: 1.txt +INVALID-NEXT: 2.txt +INVALID-NEXT: 3.txt + +# Insert file at the same position: +RUN: rm -f %t-position.a +RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar ra %t1.txt %t-position.a %t2.txt +RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION + +POSITION: 1.txt +POSITION-NEXT: 2.txt +POSITION-NEXT: 3.txt diff --git a/llvm/test/tools/llvm-ar/insert-before.test b/llvm/test/tools/llvm-ar/insert-before.test index 61505d8162a..4abf3a00028 100644 --- a/llvm/test/tools/llvm-ar/insert-before.test +++ b/llvm/test/tools/llvm-ar/insert-before.test @@ -1,59 +1,59 @@ -## Test inserting files before a file.
-
-RUN: touch %t1.txt
-RUN: touch %t2.txt
-RUN: touch %t3.txt
-RUN: touch %t4.txt
-
-# Insert one file:
-RUN: rm -f %t-one.a
-RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt
-RUN: llvm-ar rb %t2.txt %t-one.a %t3.txt
-RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE
-
-ONE: 1.txt
-ONE-NEXT: 3.txt
-ONE-NEXT: 2.txt
-
-# Insert file at front:
-RUN: rm -f %t-front.a
-RUN: llvm-ar rc %t-front.a %t1.txt %t2.txt
-RUN: llvm-ar rb %t1.txt %t-front.a %t3.txt
-RUN: llvm-ar t %t-front.a | FileCheck %s --check-prefix=FRONT
-
-FRONT: 3.txt
-FRONT-NEXT: 1.txt
-FRONT-NEXT: 2.txt
-
-# Insert multiple files:
-RUN: rm -f %t-multiple.a
-RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt
-RUN: llvm-ar rb %t2.txt %t-multiple.a %t4.txt %t3.txt
-RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE
-
-MULTIPLE: 1.txt
-MULTIPLE-NEXT: 4.txt
-MULTIPLE-NEXT: 3.txt
-MULTIPLE-NEXT: 2.txt
-
-# Insert before an invalid file:
-RUN: rm -f %t-invalid.a
-RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt
-RUN: not llvm-ar rb invalid.txt %t-invalid.a %t2.txt 2>&1 \
-RUN: | FileCheck %s --check-prefix=ERROR
-RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID
-
-ERROR: error: Insertion point not found.
-INVALID: 1.txt
-INVALID-NEXT: 2.txt
-INVALID-NEXT: 3.txt
-
-# Insert file at the same position:
-RUN: rm -f %t-position.a
-RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar rb %t3.txt %t-position.a %t2.txt
-RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION
-
-POSITION: 1.txt
-POSITION-NEXT: 2.txt
-POSITION-NEXT: 3.txt
+## Test inserting files before a file. + +RUN: touch %t1.txt +RUN: touch %t2.txt +RUN: touch %t3.txt +RUN: touch %t4.txt + +# Insert one file: +RUN: rm -f %t-one.a +RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt +RUN: llvm-ar rb %t2.txt %t-one.a %t3.txt +RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE + +ONE: 1.txt +ONE-NEXT: 3.txt +ONE-NEXT: 2.txt + +# Insert file at front: +RUN: rm -f %t-front.a +RUN: llvm-ar rc %t-front.a %t1.txt %t2.txt +RUN: llvm-ar rb %t1.txt %t-front.a %t3.txt +RUN: llvm-ar t %t-front.a | FileCheck %s --check-prefix=FRONT + +FRONT: 3.txt +FRONT-NEXT: 1.txt +FRONT-NEXT: 2.txt + +# Insert multiple files: +RUN: rm -f %t-multiple.a +RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt +RUN: llvm-ar rb %t2.txt %t-multiple.a %t4.txt %t3.txt +RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE + +MULTIPLE: 1.txt +MULTIPLE-NEXT: 4.txt +MULTIPLE-NEXT: 3.txt +MULTIPLE-NEXT: 2.txt + +# Insert before an invalid file: +RUN: rm -f %t-invalid.a +RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt +RUN: not llvm-ar rb invalid.txt %t-invalid.a %t2.txt 2>&1 \ +RUN: | FileCheck %s --check-prefix=ERROR +RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID + +ERROR: error: Insertion point not found. +INVALID: 1.txt +INVALID-NEXT: 2.txt +INVALID-NEXT: 3.txt + +# Insert file at the same position: +RUN: rm -f %t-position.a +RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar rb %t3.txt %t-position.a %t2.txt +RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION + +POSITION: 1.txt +POSITION-NEXT: 2.txt +POSITION-NEXT: 3.txt diff --git a/llvm/test/tools/llvm-ar/move-after.test b/llvm/test/tools/llvm-ar/move-after.test index fb61f2aa118..6a4360c3cd0 100644 --- a/llvm/test/tools/llvm-ar/move-after.test +++ b/llvm/test/tools/llvm-ar/move-after.test @@ -1,59 +1,59 @@ -## Test moving files after a file.
-
-RUN: touch %t1.txt
-RUN: touch %t2.txt
-RUN: touch %t3.txt
-RUN: touch %t4.txt
-
-# Move one file:
-RUN: rm -f %t-one.ar
-RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar ma %t1.txt %t-one.a %t3.txt
-RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE
-
-ONE: 1.txt
-ONE-NEXT: 3.txt
-ONE-NEXT: 2.txt
-
-# Move file to back:
-RUN: rm -f %t-back.ar
-RUN: llvm-ar rc %t-back.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar ma %t2.txt %t-back.a %t1.txt
-RUN: llvm-ar t %t-back.a | FileCheck %s --check-prefix=BACK
-
-BACK: 2.txt
-BACK-NEXT: 1.txt
-BACK-NEXT: 3.txt
-
-# Move multiple files:
-RUN: rm -f %t-multiple.ar
-RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt %t3.txt %t4.txt
-RUN: llvm-ar ma %t1.txt %t-multiple.a %t4.txt %t3.txt
-RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE
-
-MULTIPLE: 1.txt
-MULTIPLE-NEXT: 3.txt
-MULTIPLE-NEXT: 4.txt
-MULTIPLE-NEXT: 2.txt
-
-# Move after invalid file:
-RUN: rm -f %t-invalid.ar
-RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt
-RUN: not llvm-ar ma invalid.txt %t-invalid.a %t2.txt 2>&1 \
-RUN: | FileCheck %s --check-prefix=ERROR
-RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID
-
-ERROR: error: Insertion point not found.
-INVALID: 1.txt
-INVALID-NEXT: 2.txt
-INVALID-NEXT: 3.txt
-
-# Move file to the same position:
-RUN: rm -f %t-position.ar
-RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar ma %t1.txt %t-position.a %t2.txt
-RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION
-
-POSITION: 1.txt
-POSITION-NEXT: 2.txt
-POSITION-NEXT: 3.txt
+## Test moving files after a file. + +RUN: touch %t1.txt +RUN: touch %t2.txt +RUN: touch %t3.txt +RUN: touch %t4.txt + +# Move one file: +RUN: rm -f %t-one.ar +RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar ma %t1.txt %t-one.a %t3.txt +RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE + +ONE: 1.txt +ONE-NEXT: 3.txt +ONE-NEXT: 2.txt + +# Move file to back: +RUN: rm -f %t-back.ar +RUN: llvm-ar rc %t-back.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar ma %t2.txt %t-back.a %t1.txt +RUN: llvm-ar t %t-back.a | FileCheck %s --check-prefix=BACK + +BACK: 2.txt +BACK-NEXT: 1.txt +BACK-NEXT: 3.txt + +# Move multiple files: +RUN: rm -f %t-multiple.ar +RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt %t3.txt %t4.txt +RUN: llvm-ar ma %t1.txt %t-multiple.a %t4.txt %t3.txt +RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE + +MULTIPLE: 1.txt +MULTIPLE-NEXT: 3.txt +MULTIPLE-NEXT: 4.txt +MULTIPLE-NEXT: 2.txt + +# Move after invalid file: +RUN: rm -f %t-invalid.ar +RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt +RUN: not llvm-ar ma invalid.txt %t-invalid.a %t2.txt 2>&1 \ +RUN: | FileCheck %s --check-prefix=ERROR +RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID + +ERROR: error: Insertion point not found. +INVALID: 1.txt +INVALID-NEXT: 2.txt +INVALID-NEXT: 3.txt + +# Move file to the same position: +RUN: rm -f %t-position.ar +RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar ma %t1.txt %t-position.a %t2.txt +RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION + +POSITION: 1.txt +POSITION-NEXT: 2.txt +POSITION-NEXT: 3.txt diff --git a/llvm/test/tools/llvm-ar/move-before.test b/llvm/test/tools/llvm-ar/move-before.test index b5fefec2955..306a887e26b 100644 --- a/llvm/test/tools/llvm-ar/move-before.test +++ b/llvm/test/tools/llvm-ar/move-before.test @@ -1,69 +1,69 @@ -## Test moving files after a file.
-
-RUN: touch %t1.txt
-RUN: touch %t2.txt
-RUN: touch %t3.txt
-RUN: touch %t4.txt
-
-# Move one file:
-RUN: rm -f %t-one.ar
-RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar mb %t2.txt %t-one.a %t3.txt
-RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE
-
-ONE: 1.txt
-ONE-NEXT: 3.txt
-ONE-NEXT: 2.txt
-
-# Move file to front:
-RUN: rm -f %t-front.ar
-RUN: llvm-ar rc %t-front.ar %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar mb %t1.txt %t-front.ar %t3.txt
-RUN: llvm-ar t %t-front.ar | FileCheck %s --check-prefix=FRONT
-
-FRONT: 3.txt
-FRONT-NEXT: 1.txt
-FRONT-NEXT: 2.txt
-
-# Move multiple files:
-RUN: rm -f %t-multiple.ar
-RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt %t3.txt %t4.txt
-RUN: llvm-ar mb %t2.txt %t-multiple.a %t4.txt %t3.txt
-RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE
-
-MULTIPLE: 1.txt
-MULTIPLE-NEXT: 3.txt
-MULTIPLE-NEXT: 4.txt
-MULTIPLE-NEXT: 2.txt
-
-# Move before invalid file:
-RUN: rm -f %t-invalid.ar
-RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt
-RUN: not llvm-ar mb invalid.txt %t-invalid.a %t2.txt 2>&1 \
-RUN: | FileCheck %s --check-prefix=ERROR
-RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID
-
-ERROR: error: Insertion point not found.
-INVALID: 1.txt
-INVALID-NEXT: 2.txt
-INVALID-NEXT: 3.txt
-
-# Move file to the same position:
-RUN: rm -f %t-position.ar
-RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar mb %t3.txt %t-position.a %t2.txt
-RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION
-
-POSITION: 1.txt
-POSITION-NEXT: 2.txt
-POSITION-NEXT: 3.txt
-
-# Move file after itself:
-RUN: rm -f %t-same.ar
-RUN: llvm-ar rc %t-same.ar %t1.txt %t2.txt %t3.txt
-RUN: llvm-ar mb %t2.txt %t-same.ar %t2.txt
-RUN: llvm-ar t %t-same.ar | FileCheck %s --check-prefix=SAME
-
-SAME: 1.txt
-SAME-NEXT: 2.txt
-SAME-NEXT: 3.txt
+## Test moving files after a file. + +RUN: touch %t1.txt +RUN: touch %t2.txt +RUN: touch %t3.txt +RUN: touch %t4.txt + +# Move one file: +RUN: rm -f %t-one.ar +RUN: llvm-ar rc %t-one.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar mb %t2.txt %t-one.a %t3.txt +RUN: llvm-ar t %t-one.a | FileCheck %s --check-prefix=ONE + +ONE: 1.txt +ONE-NEXT: 3.txt +ONE-NEXT: 2.txt + +# Move file to front: +RUN: rm -f %t-front.ar +RUN: llvm-ar rc %t-front.ar %t1.txt %t2.txt %t3.txt +RUN: llvm-ar mb %t1.txt %t-front.ar %t3.txt +RUN: llvm-ar t %t-front.ar | FileCheck %s --check-prefix=FRONT + +FRONT: 3.txt +FRONT-NEXT: 1.txt +FRONT-NEXT: 2.txt + +# Move multiple files: +RUN: rm -f %t-multiple.ar +RUN: llvm-ar rc %t-multiple.a %t1.txt %t2.txt %t3.txt %t4.txt +RUN: llvm-ar mb %t2.txt %t-multiple.a %t4.txt %t3.txt +RUN: llvm-ar t %t-multiple.a | FileCheck %s --check-prefix=MULTIPLE + +MULTIPLE: 1.txt +MULTIPLE-NEXT: 3.txt +MULTIPLE-NEXT: 4.txt +MULTIPLE-NEXT: 2.txt + +# Move before invalid file: +RUN: rm -f %t-invalid.ar +RUN: llvm-ar rc %t-invalid.a %t1.txt %t2.txt %t3.txt +RUN: not llvm-ar mb invalid.txt %t-invalid.a %t2.txt 2>&1 \ +RUN: | FileCheck %s --check-prefix=ERROR +RUN: llvm-ar t %t-invalid.a | FileCheck %s --check-prefix=INVALID + +ERROR: error: Insertion point not found. +INVALID: 1.txt +INVALID-NEXT: 2.txt +INVALID-NEXT: 3.txt + +# Move file to the same position: +RUN: rm -f %t-position.ar +RUN: llvm-ar rc %t-position.a %t1.txt %t2.txt %t3.txt +RUN: llvm-ar mb %t3.txt %t-position.a %t2.txt +RUN: llvm-ar t %t-position.a | FileCheck %s --check-prefix=POSITION + +POSITION: 1.txt +POSITION-NEXT: 2.txt +POSITION-NEXT: 3.txt + +# Move file after itself: +RUN: rm -f %t-same.ar +RUN: llvm-ar rc %t-same.ar %t1.txt %t2.txt %t3.txt +RUN: llvm-ar mb %t2.txt %t-same.ar %t2.txt +RUN: llvm-ar t %t-same.ar | FileCheck %s --check-prefix=SAME + +SAME: 1.txt +SAME-NEXT: 2.txt +SAME-NEXT: 3.txt diff --git a/llvm/test/tools/llvm-ar/move.test b/llvm/test/tools/llvm-ar/move.test index c5028f52e40..268fbf94cf1 100644 --- a/llvm/test/tools/llvm-ar/move.test +++ b/llvm/test/tools/llvm-ar/move.test @@ -1,129 +1,129 @@ -## Test the move command without modifiers moves members to the end
-
-# RUN: rm -rf %t && mkdir -p %t
-# RUN: yaml2obj %s -o %t/1.o --docnum=1
-# RUN: yaml2obj %s -o %t/2.o --docnum=2
-# RUN: yaml2obj %s -o %t/3.o --docnum=3
-
-## Move single member:
-# RUN: llvm-ar rc %t/single.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar m %t/single.a %t/1.o
-# RUN: llvm-ar t %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}
-
-# SINGLE: 2.o
-# SINGLE-NEXT: 3.o
-# SINGLE-NEXT: 1.o
-
-# RUN: llvm-nm --print-armap %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE-SYM
-
-# SINGLE-SYM: symbol2
-# SINGLE-SYM-NEXT: symbol3
-# SINGLE-SYM-NEXT: symbol1
-
-## Move multiple members:
-# RUN: llvm-ar rc %t/multiple.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar m %t/multiple.a %t/1.o %t/2.o
-# RUN: llvm-ar t %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}
-
-# MULTIPLE: 3.o
-# MULTIPLE-NEXT: 1.o
-# MULTIPLE-NEXT: 2.o
-
-# RUN: llvm-nm --print-armap %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
-
-# MULTIPLE-SYM: symbol3
-# MULTIPLE-SYM-NEXT: symbol1
-# MULTIPLE-SYM-NEXT: symbol2
-
-## Move same member:
-# RUN: llvm-ar rc %t/same.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar m %t/same.a %t/1.o %t/1.o
-# RUN: llvm-ar t %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o
-
-# SAME: 2.o
-# SAME-NEXT: 3.o
-# SAME-NEXT: 1.o
-
-# RUN: llvm-nm --print-armap %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME-SYM
-
-# SAME-SYM: symbol2
-# SAME-SYM-NEXT: symbol3
-# SAME-SYM-NEXT: symbol1
-
-## Move without member:
-# RUN: llvm-ar rc %t/without.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar m %t/without.a
-# RUN: llvm-ar t %t/without.a \
-# RUN: | FileCheck %s --match-full-lines --check-prefix=WITHOUT --implicit-check-not {{.}}
-
-# WITHOUT: 1.o
-# WITHOUT-NEXT: 2.o
-# WITHOUT-NEXT: 3.o
-
-# RUN: llvm-nm --print-armap %t/without.a \
-# RUN: | FileCheck %s --check-prefix=WITHOUT-SYM
-
-# WITHOUT-SYM: symbol1
-# WITHOUT-SYM-NEXT: symbol2
-# WITHOUT-SYM-NEXT: symbol3
-
-## No archive:
-# RUN: not llvm-ar m 2>&1 \
-# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE
-
-# NO-ARCHIVE: error: An archive name must be specified.
-
-## Member does not exist:
-# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o
-# RUN: not llvm-ar m %t/missing.a %t/missing.txt 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt
-
-# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory.
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol2
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol3
- Binding: STB_GLOBAL
- Section: .text
+## Test the move command without modifiers moves members to the end + +# RUN: rm -rf %t && mkdir -p %t +# RUN: yaml2obj %s -o %t/1.o --docnum=1 +# RUN: yaml2obj %s -o %t/2.o --docnum=2 +# RUN: yaml2obj %s -o %t/3.o --docnum=3 + +## Move single member: +# RUN: llvm-ar rc %t/single.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar m %t/single.a %t/1.o +# RUN: llvm-ar t %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} + +# SINGLE: 2.o +# SINGLE-NEXT: 3.o +# SINGLE-NEXT: 1.o + +# RUN: llvm-nm --print-armap %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE-SYM + +# SINGLE-SYM: symbol2 +# SINGLE-SYM-NEXT: symbol3 +# SINGLE-SYM-NEXT: symbol1 + +## Move multiple members: +# RUN: llvm-ar rc %t/multiple.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar m %t/multiple.a %t/1.o %t/2.o +# RUN: llvm-ar t %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}} + +# MULTIPLE: 3.o +# MULTIPLE-NEXT: 1.o +# MULTIPLE-NEXT: 2.o + +# RUN: llvm-nm --print-armap %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM + +# MULTIPLE-SYM: symbol3 +# MULTIPLE-SYM-NEXT: symbol1 +# MULTIPLE-SYM-NEXT: symbol2 + +## Move same member: +# RUN: llvm-ar rc %t/same.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar m %t/same.a %t/1.o %t/1.o +# RUN: llvm-ar t %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o + +# SAME: 2.o +# SAME-NEXT: 3.o +# SAME-NEXT: 1.o + +# RUN: llvm-nm --print-armap %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME-SYM + +# SAME-SYM: symbol2 +# SAME-SYM-NEXT: symbol3 +# SAME-SYM-NEXT: symbol1 + +## Move without member: +# RUN: llvm-ar rc %t/without.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar m %t/without.a +# RUN: llvm-ar t %t/without.a \ +# RUN: | FileCheck %s --match-full-lines --check-prefix=WITHOUT --implicit-check-not {{.}} + +# WITHOUT: 1.o +# WITHOUT-NEXT: 2.o +# WITHOUT-NEXT: 3.o + +# RUN: llvm-nm --print-armap %t/without.a \ +# RUN: | FileCheck %s --check-prefix=WITHOUT-SYM + +# WITHOUT-SYM: symbol1 +# WITHOUT-SYM-NEXT: symbol2 +# WITHOUT-SYM-NEXT: symbol3 + +## No archive: +# RUN: not llvm-ar m 2>&1 \ +# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE + +# NO-ARCHIVE: error: An archive name must be specified. + +## Member does not exist: +# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o +# RUN: not llvm-ar m %t/missing.a %t/missing.txt 2>&1 \ +# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt + +# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory. + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol2 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol3 + Binding: STB_GLOBAL + Section: .text diff --git a/llvm/test/tools/llvm-ar/mri-addlib.test b/llvm/test/tools/llvm-ar/mri-addlib.test index c297653e2ab..cf62acbf0b0 100644 --- a/llvm/test/tools/llvm-ar/mri-addlib.test +++ b/llvm/test/tools/llvm-ar/mri-addlib.test @@ -1,45 +1,45 @@ -## Test the ADDLIB MRI command.
-
-# RUN: rm -rf %t && mkdir -p %t
-# RUN: yaml2obj %s -o %t/f.o
-# RUN: llvm-ar r %t/f.a %t/f.o
-
-## Merge contents of archives.
-# RUN: echo "CREATE %t/addlib.a" > %t/addlib.mri
-# RUN: echo "ADDLIB %t/f.a" >> %t/addlib.mri
-# RUN: echo "SAVE" >> %t/addlib.mri
-# RUN: llvm-ar -M < %t/addlib.mri
-# RUN: llvm-nm --print-armap %t/addlib.a | FileCheck --check-prefix=SYMS %s
-# RUN: llvm-ar t %t/addlib.a | FileCheck --check-prefix=FILES %s
-
-# SYMS: f in {{.*}}
-# FILES: f.o
-
-## ADDLIB with non-archive file.
-# RUN: echo "CREATE %t/badlib.a" > %t/badlib.mri
-# RUN: echo "ADDLIB %s" >> %t/badlib.mri
-# RUN: echo "SAVE" >> %t/badlib.mri
-# RUN: not llvm-ar -M < %t/badlib.mri 2>&1 | FileCheck --check-prefix=PARSE %s
-# RUN: not ls %t/badlib.a
-
-# PARSE: Could not parse library
-
-## No create command.
-# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri
-# RUN: echo "SAVE" >> %t/nocreate.mri
-# RUN: not llvm-ar -M < %t/nocreate.mri
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: f
- Binding: STB_GLOBAL
- Section: .text
-...
+## Test the ADDLIB MRI command. + +# RUN: rm -rf %t && mkdir -p %t +# RUN: yaml2obj %s -o %t/f.o +# RUN: llvm-ar r %t/f.a %t/f.o + +## Merge contents of archives. +# RUN: echo "CREATE %t/addlib.a" > %t/addlib.mri +# RUN: echo "ADDLIB %t/f.a" >> %t/addlib.mri +# RUN: echo "SAVE" >> %t/addlib.mri +# RUN: llvm-ar -M < %t/addlib.mri +# RUN: llvm-nm --print-armap %t/addlib.a | FileCheck --check-prefix=SYMS %s +# RUN: llvm-ar t %t/addlib.a | FileCheck --check-prefix=FILES %s + +# SYMS: f in {{.*}} +# FILES: f.o + +## ADDLIB with non-archive file. +# RUN: echo "CREATE %t/badlib.a" > %t/badlib.mri +# RUN: echo "ADDLIB %s" >> %t/badlib.mri +# RUN: echo "SAVE" >> %t/badlib.mri +# RUN: not llvm-ar -M < %t/badlib.mri 2>&1 | FileCheck --check-prefix=PARSE %s +# RUN: not ls %t/badlib.a + +# PARSE: Could not parse library + +## No create command. +# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri +# RUN: echo "SAVE" >> %t/nocreate.mri +# RUN: not llvm-ar -M < %t/nocreate.mri + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: f + Binding: STB_GLOBAL + Section: .text +... diff --git a/llvm/test/tools/llvm-ar/mri-addmod.test b/llvm/test/tools/llvm-ar/mri-addmod.test index 2b6e4dc3adb..c26414fad0b 100644 --- a/llvm/test/tools/llvm-ar/mri-addmod.test +++ b/llvm/test/tools/llvm-ar/mri-addmod.test @@ -1,27 +1,27 @@ -## Test the ADDMOD MRI command.
-
-# RUN: rm -rf %t && mkdir -p %t
-# RUN: yaml2obj %s -o %t/f.o
-
-# RUN: echo "CREATE %t/addmod.a" > %t/addmod.mri
-# RUN: echo "ADDMOD %t/f.o" >> %t/addmod.mri
-# RUN: echo "SAVE" >> %t/addmod.mri
-# RUN: llvm-ar -M < %t/addmod.mri
-# RUN: llvm-nm --print-armap %t/addmod.a | FileCheck %s
-
-# CHECK: f in f.o
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: f
- Binding: STB_GLOBAL
- Section: .text
-...
+## Test the ADDMOD MRI command. + +# RUN: rm -rf %t && mkdir -p %t +# RUN: yaml2obj %s -o %t/f.o + +# RUN: echo "CREATE %t/addmod.a" > %t/addmod.mri +# RUN: echo "ADDMOD %t/f.o" >> %t/addmod.mri +# RUN: echo "SAVE" >> %t/addmod.mri +# RUN: llvm-ar -M < %t/addmod.mri +# RUN: llvm-nm --print-armap %t/addmod.a | FileCheck %s + +# CHECK: f in f.o + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: f + Binding: STB_GLOBAL + Section: .text +... diff --git a/llvm/test/tools/llvm-ar/mri-comments.test b/llvm/test/tools/llvm-ar/mri-comments.test index f5fa61768ae..aac62dc00e6 100644 --- a/llvm/test/tools/llvm-ar/mri-comments.test +++ b/llvm/test/tools/llvm-ar/mri-comments.test @@ -1,19 +1,19 @@ -# Test different MRI comment formats and white space.
-
-RUN: rm -rf %t && mkdir -p %t
-RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o
-
-RUN: echo "create %t/mri.ar;comment" > %t/script.mri
-RUN: echo "addmod %t/elf.o * comment" >> %t/script.mri
-RUN: echo "; comment" >> %t/script.mri
-RUN: echo " ;comment" >> %t/script.mri
-RUN: echo "* comment" >> %t/script.mri
-RUN: echo " *comment" >> %t/script.mri
-RUN: echo "" >> %t/script.mri
-RUN: echo " " >> %t/script.mri
-RUN: echo " save" >> %t/script.mri
-
-RUN: llvm-ar -M < %t/script.mri
-RUN: llvm-ar t %t/mri.ar | FileCheck %s
-
-CHECK: elf.o
+# Test different MRI comment formats and white space. + +RUN: rm -rf %t && mkdir -p %t +RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o + +RUN: echo "create %t/mri.ar;comment" > %t/script.mri +RUN: echo "addmod %t/elf.o * comment" >> %t/script.mri +RUN: echo "; comment" >> %t/script.mri +RUN: echo " ;comment" >> %t/script.mri +RUN: echo "* comment" >> %t/script.mri +RUN: echo " *comment" >> %t/script.mri +RUN: echo "" >> %t/script.mri +RUN: echo " " >> %t/script.mri +RUN: echo " save" >> %t/script.mri + +RUN: llvm-ar -M < %t/script.mri +RUN: llvm-ar t %t/mri.ar | FileCheck %s + +CHECK: elf.o diff --git a/llvm/test/tools/llvm-ar/mri-end.test b/llvm/test/tools/llvm-ar/mri-end.test index db4abce7d18..a00f2f53aee 100644 --- a/llvm/test/tools/llvm-ar/mri-end.test +++ b/llvm/test/tools/llvm-ar/mri-end.test @@ -1,48 +1,48 @@ -# The END MRI command is optional. Scripts that omit
-# or include END should be handled by llvm-ar.
-RUN: rm -rf %t && mkdir -p %t
-
-# Empty File
-RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o
-
-RUN: touch %t/empty.mri
-RUN: llvm-ar -M < %t/empty.mri
-
-RUN: echo "END" > %t/empty-end.mri
-RUN: llvm-ar -M < %t/empty-end.mri
-
-# Comment only
-RUN: echo "; a comment" > %t/comment.mri
-RUN: llvm-ar -M < %t/comment.mri
-
-RUN: echo "; a comment" > %t/comment-end.mri
-RUN: echo "END" > %t/comment-end.mri
-RUN: llvm-ar -M < %t/comment-end.mri
-
-# Without Save
-RUN: echo "create %t/mri.ar" > %t/no-save.mri
-RUN: echo "addmod %t/elf.o" >> %t/no-save.mri
-RUN: llvm-ar -M < %t/no-save.mri
-RUN: test ! -e %t/mri.ar
-
-RUN: echo "create %t/mri.ar" > %t/no-save-end.mri
-RUN: echo "addmod %t/elf.o" >> %t/no-save-end.mri
-RUN: echo "END" > %t/no-save-end.mri
-RUN: llvm-ar -M < %t/no-save-end.mri
-RUN: test ! -e %t/mri.ar
-
-# With Save
-RUN: echo "create %t/mri.ar" > %t/save.mri
-RUN: echo "addmod %t/elf.o" >> %t/save.mri
-RUN: echo "save" >> %t/save.mri
-RUN: llvm-ar -M < %t/save.mri
-RUN: llvm-ar t %t/mri.ar | FileCheck %s
-
-RUN: echo "create %t/mri.ar" > %t/save-end.mri
-RUN: echo "addmod %t/elf.o" >> %t/save-end.mri
-RUN: echo "save" >> %t/save-end.mri
-RUN: echo "END" > %t/no-save-end.mri
-RUN: llvm-ar -M < %t/save-end.mri
-RUN: llvm-ar t %t/mri.ar | FileCheck %s
-
-CHECK: elf.o
+# The END MRI command is optional. Scripts that omit +# or include END should be handled by llvm-ar. +RUN: rm -rf %t && mkdir -p %t + +# Empty File +RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o + +RUN: touch %t/empty.mri +RUN: llvm-ar -M < %t/empty.mri + +RUN: echo "END" > %t/empty-end.mri +RUN: llvm-ar -M < %t/empty-end.mri + +# Comment only +RUN: echo "; a comment" > %t/comment.mri +RUN: llvm-ar -M < %t/comment.mri + +RUN: echo "; a comment" > %t/comment-end.mri +RUN: echo "END" > %t/comment-end.mri +RUN: llvm-ar -M < %t/comment-end.mri + +# Without Save +RUN: echo "create %t/mri.ar" > %t/no-save.mri +RUN: echo "addmod %t/elf.o" >> %t/no-save.mri +RUN: llvm-ar -M < %t/no-save.mri +RUN: test ! -e %t/mri.ar + +RUN: echo "create %t/mri.ar" > %t/no-save-end.mri +RUN: echo "addmod %t/elf.o" >> %t/no-save-end.mri +RUN: echo "END" > %t/no-save-end.mri +RUN: llvm-ar -M < %t/no-save-end.mri +RUN: test ! -e %t/mri.ar + +# With Save +RUN: echo "create %t/mri.ar" > %t/save.mri +RUN: echo "addmod %t/elf.o" >> %t/save.mri +RUN: echo "save" >> %t/save.mri +RUN: llvm-ar -M < %t/save.mri +RUN: llvm-ar t %t/mri.ar | FileCheck %s + +RUN: echo "create %t/mri.ar" > %t/save-end.mri +RUN: echo "addmod %t/elf.o" >> %t/save-end.mri +RUN: echo "save" >> %t/save-end.mri +RUN: echo "END" > %t/no-save-end.mri +RUN: llvm-ar -M < %t/save-end.mri +RUN: llvm-ar t %t/mri.ar | FileCheck %s + +CHECK: elf.o diff --git a/llvm/test/tools/llvm-ar/quick-append.test b/llvm/test/tools/llvm-ar/quick-append.test index ef2e5f74cc8..607ba413ae0 100644 --- a/llvm/test/tools/llvm-ar/quick-append.test +++ b/llvm/test/tools/llvm-ar/quick-append.test @@ -1,93 +1,91 @@ -## Test quick append
-
-# RUN: rm -rf %t && mkdir -p %t
-# RUN: yaml2obj %s -o %t/1.o --docnum=1
-# RUN: yaml2obj %s -o %t/2.o --docnum=2
-
-## Append single member:
-# RUN: llvm-ar qc %t/single.a %t/1.o
-# RUN: llvm-ar t %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}
-
-# SINGLE: 1.o
-
-# RUN: llvm-nm --print-armap %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE-SYM
-
-# SINGLE-SYM: symbol1
-
-## Append multiple members:
-# RUN: llvm-ar qc %t/multiple.a %t/1.o %t/2.o
-# RUN: llvm-ar t %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}
-
-# MULTIPLE: 1.o
-# MULTIPLE-NEXT: 2.o
-
-# RUN: llvm-nm --print-armap %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
-
-# MULTIPLE-SYM: symbol1
-# MULTIPLE-SYM-NEXT: symbol2
-
-## Append same member:
-# RUN: llvm-ar qc %t/same.a %t/1.o %t/1.o
-# RUN: llvm-ar t %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --match-full-lines --implicit-check-not {{.}}
-
-# SAME: 1.o
-# SAME-NEXT: 1.o
-
-# RUN: llvm-nm --print-armap %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME-SYM
-
-# SAME-SYM: symbol1
-# SAME-SYM-NEXT: symbol1
-
-## Append without member:
-# RUN: llvm-ar qc %t/without.a
-# RUN: llvm-ar t %t/without.a \
-# RUN: | FileCheck /dev/null --allow-empty --implicit-check-not={{.}}
-
-# RUN: llvm-nm --print-armap %t/without.a \
-# RUN: | FileCheck /dev/null --allow-empty --implicit-check-not={{.}}
-
-## No archive:
-# RUN: not llvm-ar qc 2>&1 \
-# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE
-
-# NO-ARCHIVE: error: An archive name must be specified.
-
-## Member does not exist:
-# RUN: not llvm-ar qc %t/missing.a %t/missing.txt 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt
-
-# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory.
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol2
- Binding: STB_GLOBAL
- Section: .text
+## Test quick append + +# RUN: rm -rf %t && mkdir -p %t +# RUN: yaml2obj %s -o %t/1.o --docnum=1 +# RUN: yaml2obj %s -o %t/2.o --docnum=2 + +## Append single member: +# RUN: llvm-ar qc %t/single.a %t/1.o +# RUN: llvm-ar t %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} + +# SINGLE: 1.o + +# RUN: llvm-nm --print-armap %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE-SYM + +# SINGLE-SYM: symbol1 + +## Append multiple members: +# RUN: llvm-ar qc %t/multiple.a %t/1.o %t/2.o +# RUN: llvm-ar t %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}} + +# MULTIPLE: 1.o +# MULTIPLE-NEXT: 2.o + +# RUN: llvm-nm --print-armap %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM + +# MULTIPLE-SYM: symbol1 +# MULTIPLE-SYM-NEXT: symbol2 + +## Append same member: +# RUN: llvm-ar qc %t/same.a %t/1.o %t/1.o +# RUN: llvm-ar t %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --match-full-lines --implicit-check-not {{.}} + +# SAME: 1.o +# SAME-NEXT: 1.o + +# RUN: llvm-nm --print-armap %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME-SYM + +# SAME-SYM: symbol1 +# SAME-SYM-NEXT: symbol1 + +## Append without member: +# RUN: llvm-ar qc %t/without.a +# RUN: llvm-ar t %t/without.a | count 0 + +# RUN: llvm-nm --print-armap %t/without.a | count 0 + +## No archive: +# RUN: not llvm-ar qc 2>&1 \ +# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE + +# NO-ARCHIVE: error: An archive name must be specified. + +## Member does not exist: +# RUN: not llvm-ar qc %t/missing.a %t/missing.txt 2>&1 \ +# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt + +# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory. + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol2 + Binding: STB_GLOBAL + Section: .text diff --git a/llvm/test/tools/llvm-ar/read-only-archive.test b/llvm/test/tools/llvm-ar/read-only-archive.test index f4adea20218..1d638f45cac 100644 --- a/llvm/test/tools/llvm-ar/read-only-archive.test +++ b/llvm/test/tools/llvm-ar/read-only-archive.test @@ -1,30 +1,30 @@ -## Test that read-only archives cannot be edited
-
-# RUN: rm -rf %t && mkdir -p %t
-# RUN: touch %t/1.txt
-# RUN: touch %t/2.txt
-# RUN: touch %t/3.txt
-
-# RUN: llvm-ar rc %t/archive.a %t/1.txt %t/2.txt
-
-## Make read only:
-# RUN: chmod 444 %t/archive.a
-
-# RUN: not llvm-ar r %t/archive.a %t/3.txt \
-# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a
-
-# ERROR: error: [[FILE]]: no such file or directory.
-
-# RUN: not llvm-ar q %t/archive.a %t/3.txt \
-# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a
-
-# RUN: not llvm-ar m %t/archive.a t/1.txt \
-# RUN: FileCheck %s --check-prefix=ERROR-2 -DFILE=%t/archive.a
-
-# ERROR-2: error: [[FILE]]: permission denied.
-
-# RUN: llvm-ar t %t/archive.a \
-# RUN: | FileCheck %s --check-prefix=ARCHIVE --match-full-lines --implicit-check-not {{.}}
-
-# ARCHIVE: 1.txt
-# ARCHIVE-NEXT: 2.txt
+## Test that read-only archives cannot be edited + +# RUN: rm -rf %t && mkdir -p %t +# RUN: touch %t/1.txt +# RUN: touch %t/2.txt +# RUN: touch %t/3.txt + +# RUN: llvm-ar rc %t/archive.a %t/1.txt %t/2.txt + +## Make read only: +# RUN: chmod 444 %t/archive.a + +# RUN: not llvm-ar r %t/archive.a %t/3.txt \ +# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a + +# ERROR: error: [[FILE]]: no such file or directory. + +# RUN: not llvm-ar q %t/archive.a %t/3.txt \ +# RUN: FileCheck %s --check-prefix=ERROR -DFILE=%t/archive.a + +# RUN: not llvm-ar m %t/archive.a t/1.txt \ +# RUN: FileCheck %s --check-prefix=ERROR-2 -DFILE=%t/archive.a + +# ERROR-2: error: [[FILE]]: permission denied. + +# RUN: llvm-ar t %t/archive.a \ +# RUN: | FileCheck %s --check-prefix=ARCHIVE --match-full-lines --implicit-check-not {{.}} + +# ARCHIVE: 1.txt +# ARCHIVE-NEXT: 2.txt diff --git a/llvm/test/tools/llvm-ar/replace-update.test b/llvm/test/tools/llvm-ar/replace-update.test index 1b51dba1bca..c056565f144 100644 --- a/llvm/test/tools/llvm-ar/replace-update.test +++ b/llvm/test/tools/llvm-ar/replace-update.test @@ -1,189 +1,189 @@ -## Test that the replace command with "u" updates the relevant members.
-
-# RUN: rm -rf %t && mkdir -p %t/new/other
-
-# RUN: yaml2obj %s -o %t/1.o --docnum=1
-# RUN: yaml2obj %s -o %t/2.o --docnum=2
-# RUN: yaml2obj %s -o %t/3.o --docnum=3
-
-# RUN: env TZ=GMT touch -t 200001020304 %t/1.o
-# RUN: env TZ=GMT touch -t 200001020304 %t/2.o
-# RUN: env TZ=GMT touch -t 200001020304 %t/3.o
-
-# RUN: yaml2obj %s -o %t/new/1.o --docnum=4
-# RUN: yaml2obj %s -o %t/new/3.o --docnum=5
-
-# RUN: yaml2obj %s -o %t/new/other/1.o --docnum=6
-
-# RUN: env TZ=GMT touch -t 200001020304 %t/new/other/1.o
-
-## Replace single member with newer file:
-# RUN: llvm-ar rcU %t/single.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar ruU %t/single.a %t/new/1.o
-# RUN: llvm-ar t %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}}
-
-# SINGLE: 1.o
-# SINGLE-NEXT: 2.o
-# SINGLE-NEXT: 3.o
-
-# RUN: llvm-nm --print-armap %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE-SYM
-
-# SINGLE-SYM: symbolnew1
-# SINGLE-SYM-NEXT: symbol2
-# SINGLE-SYM-NEXT: symbol3
-
-## Replace new single member with older file:
-# RUN: llvm-ar ruU %t/single.a %t/1.o
-# RUN: llvm-ar t %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}}
-
-# RUN: llvm-nm --print-armap %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE-SYM
-
-## Replace multiple members with newer files:
-# RUN: llvm-ar rcuU %t/multiple.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar ruU %t/multiple.a %t/new/1.o %t/new/3.o
-# RUN: llvm-ar t %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
-
-# MULTIPLE: 1.o
-# MULTIPLE-NEXT: 2.o
-# MULTIPLE-NEXT: 3.o
-
-# RUN: llvm-nm --print-armap %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
-
-# MULTIPLE-SYM: symbolnew1
-# MULTIPLE-SYM-NEXT: symbol2
-# MULTIPLE-SYM-NEXTs: symbolnew3
-
-## Replace newer members with multiple older files:
-# RUN: llvm-ar ruU %t/multiple.a %t/1.o %t/2.o
-# RUN: llvm-ar t %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
-
-# RUN: llvm-nm --print-armap %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
-
-## Replace same member with newer files:
-# RUN: llvm-ar rcuU %t/same.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar ruU %t/same.a %t/new/1.o %t/new/other/1.o
-# RUN: llvm-ar t %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --implicit-check-not {{.}}
-
-# SAME: 1.o
-# SAME-NEXT: 2.o
-# SAME-NEXT: 3.o
-# SAME-NEXT: 1.o
-
-# RUN: llvm-nm --print-armap %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME-SYM
-
-# SAME-SYM: symbolnew1
-# SAME-SYM-NEXT: symbol2
-# SAME-SYM-NEXT: symbol3
-# SAME-SYM-NEXT: symbolother1
-
-## Replace multiple members with an older file and a newer file:
-# RUN: llvm-ar rcuU %t/old-new.a %t/new/1.o %t/2.o %t/3.o
-# RUN: llvm-ar ruU %t/old-new.a %t/1.o %t/new/3.o
-# RUN: llvm-ar t %t/old-new.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
-
-# RUN: llvm-nm --print-armap %t/old-new.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
-
-## Replace same member with an older file and a newer file:
-# RUN: llvm-ar rcuU %t/old-new-same.a %t/new/1.o %t/2.o %t/3.o
-# RUN: llvm-ar ruU %t/old-new-same.a %t/1.o %t/new/other/1.o
-# RUN: llvm-ar t %t/old-new-same.a \
-# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --implicit-check-not {{.}}
-
-# RUN: llvm-nm --print-armap %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME-SYM
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol2
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol3
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbolnew1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbolnew3
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbolother1
- Binding: STB_GLOBAL
- Section: .text
+## Test that the replace command with "u" updates the relevant members. + +# RUN: rm -rf %t && mkdir -p %t/new/other + +# RUN: yaml2obj %s -o %t/1.o --docnum=1 +# RUN: yaml2obj %s -o %t/2.o --docnum=2 +# RUN: yaml2obj %s -o %t/3.o --docnum=3 + +# RUN: env TZ=GMT touch -t 200001020304 %t/1.o +# RUN: env TZ=GMT touch -t 200001020304 %t/2.o +# RUN: env TZ=GMT touch -t 200001020304 %t/3.o + +# RUN: yaml2obj %s -o %t/new/1.o --docnum=4 +# RUN: yaml2obj %s -o %t/new/3.o --docnum=5 + +# RUN: yaml2obj %s -o %t/new/other/1.o --docnum=6 + +# RUN: env TZ=GMT touch -t 200001020304 %t/new/other/1.o + +## Replace single member with newer file: +# RUN: llvm-ar rcU %t/single.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar ruU %t/single.a %t/new/1.o +# RUN: llvm-ar t %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}} + +# SINGLE: 1.o +# SINGLE-NEXT: 2.o +# SINGLE-NEXT: 3.o + +# RUN: llvm-nm --print-armap %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE-SYM + +# SINGLE-SYM: symbolnew1 +# SINGLE-SYM-NEXT: symbol2 +# SINGLE-SYM-NEXT: symbol3 + +## Replace new single member with older file: +# RUN: llvm-ar ruU %t/single.a %t/1.o +# RUN: llvm-ar t %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}} + +# RUN: llvm-nm --print-armap %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE-SYM + +## Replace multiple members with newer files: +# RUN: llvm-ar rcuU %t/multiple.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar ruU %t/multiple.a %t/new/1.o %t/new/3.o +# RUN: llvm-ar t %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}} + +# MULTIPLE: 1.o +# MULTIPLE-NEXT: 2.o +# MULTIPLE-NEXT: 3.o + +# RUN: llvm-nm --print-armap %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM + +# MULTIPLE-SYM: symbolnew1 +# MULTIPLE-SYM-NEXT: symbol2 +# MULTIPLE-SYM-NEXTs: symbolnew3 + +## Replace newer members with multiple older files: +# RUN: llvm-ar ruU %t/multiple.a %t/1.o %t/2.o +# RUN: llvm-ar t %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}} + +# RUN: llvm-nm --print-armap %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM + +## Replace same member with newer files: +# RUN: llvm-ar rcuU %t/same.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar ruU %t/same.a %t/new/1.o %t/new/other/1.o +# RUN: llvm-ar t %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --implicit-check-not {{.}} + +# SAME: 1.o +# SAME-NEXT: 2.o +# SAME-NEXT: 3.o +# SAME-NEXT: 1.o + +# RUN: llvm-nm --print-armap %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME-SYM + +# SAME-SYM: symbolnew1 +# SAME-SYM-NEXT: symbol2 +# SAME-SYM-NEXT: symbol3 +# SAME-SYM-NEXT: symbolother1 + +## Replace multiple members with an older file and a newer file: +# RUN: llvm-ar rcuU %t/old-new.a %t/new/1.o %t/2.o %t/3.o +# RUN: llvm-ar ruU %t/old-new.a %t/1.o %t/new/3.o +# RUN: llvm-ar t %t/old-new.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}} + +# RUN: llvm-nm --print-armap %t/old-new.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM + +## Replace same member with an older file and a newer file: +# RUN: llvm-ar rcuU %t/old-new-same.a %t/new/1.o %t/2.o %t/3.o +# RUN: llvm-ar ruU %t/old-new-same.a %t/1.o %t/new/other/1.o +# RUN: llvm-ar t %t/old-new-same.a \ +# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o --implicit-check-not {{.}} + +# RUN: llvm-nm --print-armap %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME-SYM + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol2 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol3 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbolnew1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbolnew3 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbolother1 + Binding: STB_GLOBAL + Section: .text diff --git a/llvm/test/tools/llvm-ar/replace.test b/llvm/test/tools/llvm-ar/replace.test index 2a7cddfdeb5..0c1722a23ef 100644 --- a/llvm/test/tools/llvm-ar/replace.test +++ b/llvm/test/tools/llvm-ar/replace.test @@ -1,178 +1,178 @@ -## Test the replace command without modifiers replaces the relevant members.
-
-# RUN: rm -rf %t && mkdir -p %t/new/other
-# RUN: yaml2obj %s -o %t/1.o --docnum=1
-# RUN: yaml2obj %s -o %t/2.o --docnum=2
-# RUN: yaml2obj %s -o %t/3.o --docnum=3
-
-# RUN: yaml2obj %s -o %t/new/1.o --docnum=4
-# RUN: yaml2obj %s -o %t/new/3.o --docnum=5
-
-# RUN: yaml2obj %s -o %t/new/other/1.o --docnum=6
-
-## Replace single member:
-# RUN: llvm-ar rc %t/single.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar r %t/single.a %t/new/1.o
-# RUN: llvm-ar t %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}}
-
-# SINGLE: 1.o
-# SINGLE-NEXT: 2.o
-# SINGLE-NEXT: 3.o
-
-# RUN: llvm-nm --print-armap %t/single.a \
-# RUN: | FileCheck %s --check-prefix=SINGLE-SYM
-
-# SINGLE-SYM: symbolnew1
-# SINGLE-SYM-NEXT: symbol2
-# SINGLE-SYM-NEXT: symbol3
-
-## Replace multiple members:
-# RUN: llvm-ar rc %t/multiple.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar r %t/multiple.a %t/new/1.o %t/new/3.o
-# RUN: llvm-ar t %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}}
-
-# MULTIPLE: 1.o
-# MULTIPLE-NEXT: 2.o
-# MULTIPLE-NEXT: 3.o
-
-# RUN: llvm-nm --print-armap %t/multiple.a \
-# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM
-
-# MULTIPLE-SYM: symbolnew1
-# MULTIPLE-SYM-NEXT: symbol2
-# MULTIPLE-SYM-NEXT: symbolnew3
-
-## Replace same member:
-# RUN: llvm-ar rc %t/same.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar r %t/same.a %t/new/1.o %t/new/other/1.o
-# RUN: llvm-ar t %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME --implicit-check-not {{.}}
-
-# SAME: 1.o
-# SAME-NEXT: 2.o
-# SAME-NEXT: 3.o
-# SAME-NEXT: 1.o
-
-# RUN: llvm-nm --print-armap %t/same.a \
-# RUN: | FileCheck %s --check-prefix=SAME-SYM
-
-# SAME-SYM: symbolnew1
-# SAME-SYM-NEXT: symbol2
-# SAME-SYM-NEXT: symbol3
-# SAME-SYM-NEXT: symbolother1
-
-## Replace without member:
-# RUN: llvm-ar rc %t/without.a %t/1.o %t/2.o %t/3.o
-# RUN: llvm-ar r %t/without.a
-# RUN: llvm-ar t %t/without.a \
-# RUN: | FileCheck %s --check-prefix=WITHOUT --implicit-check-not {{.}}
-
-# WITHOUT: 1.o
-# WITHOUT-NEXT: 2.o
-# WITHOUT-NEXT: 3.o
-
-# RUN: llvm-nm --print-armap %t/without.a \
-# RUN: | FileCheck %s --check-prefix=WITHOUT-SYM
-
-# WITHOUT-SYM: symbol1
-# WITHOUT-SYM-NEXT: symbol2
-# WITHOUT-SYM-NEXT: symbol3
-
-## No archive:
-# RUN: not llvm-ar r 2>&1 \
-# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE
-
-# NO-ARCHIVE: error: An archive name must be specified.
-
-## Member does not exist:
-# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o
-# RUN: not llvm-ar r %t/missing.a %t/missing.txt 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt
-
-# MISSING-FILE: error: [[FILE]]: {{[Nn]}}o such file or directory.
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol2
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol3
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbolnew1
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbolnew3
- Binding: STB_GLOBAL
- Section: .text
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbolother1
- Binding: STB_GLOBAL
- Section: .text
+## Test the replace command without modifiers replaces the relevant members. + +# RUN: rm -rf %t && mkdir -p %t/new/other +# RUN: yaml2obj %s -o %t/1.o --docnum=1 +# RUN: yaml2obj %s -o %t/2.o --docnum=2 +# RUN: yaml2obj %s -o %t/3.o --docnum=3 + +# RUN: yaml2obj %s -o %t/new/1.o --docnum=4 +# RUN: yaml2obj %s -o %t/new/3.o --docnum=5 + +# RUN: yaml2obj %s -o %t/new/other/1.o --docnum=6 + +## Replace single member: +# RUN: llvm-ar rc %t/single.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar r %t/single.a %t/new/1.o +# RUN: llvm-ar t %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE --implicit-check-not {{.}} + +# SINGLE: 1.o +# SINGLE-NEXT: 2.o +# SINGLE-NEXT: 3.o + +# RUN: llvm-nm --print-armap %t/single.a \ +# RUN: | FileCheck %s --check-prefix=SINGLE-SYM + +# SINGLE-SYM: symbolnew1 +# SINGLE-SYM-NEXT: symbol2 +# SINGLE-SYM-NEXT: symbol3 + +## Replace multiple members: +# RUN: llvm-ar rc %t/multiple.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar r %t/multiple.a %t/new/1.o %t/new/3.o +# RUN: llvm-ar t %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE --implicit-check-not {{.}} + +# MULTIPLE: 1.o +# MULTIPLE-NEXT: 2.o +# MULTIPLE-NEXT: 3.o + +# RUN: llvm-nm --print-armap %t/multiple.a \ +# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM + +# MULTIPLE-SYM: symbolnew1 +# MULTIPLE-SYM-NEXT: symbol2 +# MULTIPLE-SYM-NEXT: symbolnew3 + +## Replace same member: +# RUN: llvm-ar rc %t/same.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar r %t/same.a %t/new/1.o %t/new/other/1.o +# RUN: llvm-ar t %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME --implicit-check-not {{.}} + +# SAME: 1.o +# SAME-NEXT: 2.o +# SAME-NEXT: 3.o +# SAME-NEXT: 1.o + +# RUN: llvm-nm --print-armap %t/same.a \ +# RUN: | FileCheck %s --check-prefix=SAME-SYM + +# SAME-SYM: symbolnew1 +# SAME-SYM-NEXT: symbol2 +# SAME-SYM-NEXT: symbol3 +# SAME-SYM-NEXT: symbolother1 + +## Replace without member: +# RUN: llvm-ar rc %t/without.a %t/1.o %t/2.o %t/3.o +# RUN: llvm-ar r %t/without.a +# RUN: llvm-ar t %t/without.a \ +# RUN: | FileCheck %s --check-prefix=WITHOUT --implicit-check-not {{.}} + +# WITHOUT: 1.o +# WITHOUT-NEXT: 2.o +# WITHOUT-NEXT: 3.o + +# RUN: llvm-nm --print-armap %t/without.a \ +# RUN: | FileCheck %s --check-prefix=WITHOUT-SYM + +# WITHOUT-SYM: symbol1 +# WITHOUT-SYM-NEXT: symbol2 +# WITHOUT-SYM-NEXT: symbol3 + +## No archive: +# RUN: not llvm-ar r 2>&1 \ +# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE + +# NO-ARCHIVE: error: An archive name must be specified. + +## Member does not exist: +# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o +# RUN: not llvm-ar r %t/missing.a %t/missing.txt 2>&1 \ +# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt + +# MISSING-FILE: error: [[FILE]]: {{[Nn]}}o such file or directory. + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol2 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol3 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbolnew1 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbolnew3 + Binding: STB_GLOBAL + Section: .text + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbolother1 + Binding: STB_GLOBAL + Section: .text diff --git a/llvm/test/tools/llvm-ar/symtab.test b/llvm/test/tools/llvm-ar/symtab.test index e59a468d3f2..8dde4ede581 100644 --- a/llvm/test/tools/llvm-ar/symtab.test +++ b/llvm/test/tools/llvm-ar/symtab.test @@ -1,70 +1,70 @@ -## Test the s and S modifiers. Build and do not build a symbol table.
-
-# RUN: yaml2obj %s -o %t.o
-# RUN: touch %t-other.txt
-
-## Default:
-# RUN: rm -f %t-default.a
-# RUN: llvm-ar rc %t-default.a %t.o
-# RUN: llvm-nm --print-armap %t-default.a \
-# RUN: | FileCheck %s --check-prefix=SYMTAB
-
-## Use a modifer:
-# RUN: rm -f %t-symtab.a
-# RUN: llvm-ar rcs %t-symtab.a %t.o
-# RUN: llvm-nm --print-armap %t-symtab.a \
-# RUN: | FileCheck %s --check-prefix=SYMTAB
-
-# RUN: rm -f %t-no-symtab.a
-# RUN: llvm-ar rcS %t-no-symtab.a %t.o
-# RUN: llvm-nm --print-armap %t-no-symtab.a \
-# RUN: | FileCheck %s --check-prefix=NO-SYMTAB
-
-## Use both modifers:
-# RUN: rm -f %t-symtab-last.a
-# RUN: llvm-ar rcSs %t-symtab-last.a %t.o
-# RUN: llvm-nm --print-armap %t-symtab-last.a \
-# RUN: | FileCheck %s --check-prefix=SYMTAB
-
-# RUN: rm -f %t-no-symtab-last.a
-# RUN: llvm-ar rcsS %t-no-symtab-last.a %t.o
-# RUN: llvm-nm --print-armap %t-no-symtab-last.a \
-# RUN: | FileCheck %s --check-prefix=NO-SYMTAB
-
-## Use an existing archive:
-# RUN: rm -f %t-to-symtab.a
-# RUN: llvm-ar rcS %t-to-symtab.a %t.o
-# RUN: llvm-ar rs %t-to-symtab.a %t-other.txt
-# RUN: llvm-nm --print-armap %t-to-symtab.a \
-# RUN: | FileCheck %s --check-prefix=SYMTAB
-
-# RUN: llvm-ar rs %t-to-symtab.a %t-other.txt
-# RUN: llvm-nm --print-armap %t-to-symtab.a \
-# RUN: | FileCheck %s --check-prefix=SYMTAB
-
-# RUN: rm -f %t-to-no-symtab.a
-# RUN: llvm-ar rcs %t-to-no-symtab.a %t.o
-# RUN: llvm-ar rS %t-to-no-symtab.a %t-other.txt
-# RUN: llvm-nm --print-armap %t-to-no-symtab.a \
-# RUN: | FileCheck %s --check-prefix=NO-SYMTAB
-
-# RUN: llvm-ar rS %t-to-no-symtab.a %t-other.txt
-# RUN: llvm-nm --print-armap %t-to-no-symtab.a \
-# RUN: | FileCheck %s --check-prefix=NO-SYMTAB
-
-# SYMTAB: symbol in
-# NO-SYMTAB-NOT: symbol in
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
-Symbols:
- - Name: symbol
- Binding: STB_GLOBAL
- Section: .text
+## Test the s and S modifiers. Build and do not build a symbol table. + +# RUN: yaml2obj %s -o %t.o +# RUN: touch %t-other.txt + +## Default: +# RUN: rm -f %t-default.a +# RUN: llvm-ar rc %t-default.a %t.o +# RUN: llvm-nm --print-armap %t-default.a \ +# RUN: | FileCheck %s --check-prefix=SYMTAB + +## Use a modifer: +# RUN: rm -f %t-symtab.a +# RUN: llvm-ar rcs %t-symtab.a %t.o +# RUN: llvm-nm --print-armap %t-symtab.a \ +# RUN: | FileCheck %s --check-prefix=SYMTAB + +# RUN: rm -f %t-no-symtab.a +# RUN: llvm-ar rcS %t-no-symtab.a %t.o +# RUN: llvm-nm --print-armap %t-no-symtab.a \ +# RUN: | FileCheck %s --check-prefix=NO-SYMTAB + +## Use both modifers: +# RUN: rm -f %t-symtab-last.a +# RUN: llvm-ar rcSs %t-symtab-last.a %t.o +# RUN: llvm-nm --print-armap %t-symtab-last.a \ +# RUN: | FileCheck %s --check-prefix=SYMTAB + +# RUN: rm -f %t-no-symtab-last.a +# RUN: llvm-ar rcsS %t-no-symtab-last.a %t.o +# RUN: llvm-nm --print-armap %t-no-symtab-last.a \ +# RUN: | FileCheck %s --check-prefix=NO-SYMTAB + +## Use an existing archive: +# RUN: rm -f %t-to-symtab.a +# RUN: llvm-ar rcS %t-to-symtab.a %t.o +# RUN: llvm-ar rs %t-to-symtab.a %t-other.txt +# RUN: llvm-nm --print-armap %t-to-symtab.a \ +# RUN: | FileCheck %s --check-prefix=SYMTAB + +# RUN: llvm-ar rs %t-to-symtab.a %t-other.txt +# RUN: llvm-nm --print-armap %t-to-symtab.a \ +# RUN: | FileCheck %s --check-prefix=SYMTAB + +# RUN: rm -f %t-to-no-symtab.a +# RUN: llvm-ar rcs %t-to-no-symtab.a %t.o +# RUN: llvm-ar rS %t-to-no-symtab.a %t-other.txt +# RUN: llvm-nm --print-armap %t-to-no-symtab.a \ +# RUN: | FileCheck %s --check-prefix=NO-SYMTAB + +# RUN: llvm-ar rS %t-to-no-symtab.a %t-other.txt +# RUN: llvm-nm --print-armap %t-to-no-symtab.a \ +# RUN: | FileCheck %s --check-prefix=NO-SYMTAB + +# SYMTAB: symbol in +# NO-SYMTAB-NOT: symbol in + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS +Symbols: + - Name: symbol + Binding: STB_GLOBAL + Section: .text |