[llvm] r365318 - Reapply [llvm-ar][test] Increase llvm-ar test coverage

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 11:22:54 PDT 2019


Green dragon seems sad:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/62906/consoleFull <http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/62906/consoleFull>

Is this issue fixed?


> On Jul 8, 2019, at 6:41 AM, Owen Reynolds via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: gbreynoo
> Date: Mon Jul  8 06:41:52 2019
> New Revision: 365318
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=365318&view=rev
> Log:
> Reapply [llvm-ar][test] Increase llvm-ar test coverage
> 
> This change adds tests to cover existing llvm-ar functionality.
> 
> Differential Revision: https://reviews.llvm.org/D63935
> 
> Added:
>    llvm/trunk/test/tools/llvm-ar/create.test
>    llvm/trunk/test/tools/llvm-ar/dash-before-letter.test
>    llvm/trunk/test/tools/llvm-ar/delete.test
>    llvm/trunk/test/tools/llvm-ar/extract.test
>    llvm/trunk/test/tools/llvm-ar/insert-after.test
>      - copied, changed from r365316, llvm/trunk/test/tools/llvm-ar/insert-after.test
>    llvm/trunk/test/tools/llvm-ar/insert-before.test
>      - copied, changed from r365316, llvm/trunk/test/tools/llvm-ar/insert-before.test
>    llvm/trunk/test/tools/llvm-ar/move-after.test
>    llvm/trunk/test/tools/llvm-ar/move-before.test
>    llvm/trunk/test/tools/llvm-ar/symtab.test
> Modified:
>    llvm/trunk/test/tools/llvm-ar/default-add.test
> 
> Added: llvm/trunk/test/tools/llvm-ar/create.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/create.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/create.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/create.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +1,14 @@
> +## 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={{.}}
> 
> Added: llvm/trunk/test/tools/llvm-ar/dash-before-letter.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/dash-before-letter.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/dash-before-letter.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/dash-before-letter.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +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
> 
> Modified: llvm/trunk/test/tools/llvm-ar/default-add.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/default-add.test?rev=365318&r1=365317&r2=365318&view=diff
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/default-add.test (original)
> +++ llvm/trunk/test/tools/llvm-ar/default-add.test Mon Jul  8 06:41:52 2019
> @@ -1,34 +1,20 @@
> RUN: yaml2obj %S/Inputs/macho.yaml -o %t-macho.o
> RUN: yaml2obj %S/Inputs/coff.yaml -o %t-coff.o
> +RUN: yaml2obj %S/Inputs/elf.yaml -o %t-elf.o
> 
> RUN: rm -f %t.ar
> RUN: llvm-ar crs %t.ar %t-macho.o
> RUN: grep -q __.SYMDEF %t.ar
> -Test that an option string prefixed by a dash works.
> -RUN: llvm-ar -crs %t.ar %t-coff.o
> -RUN: grep -q __.SYMDEF %t.ar
> 
> RUN: rm -f %t.ar
> RUN: llvm-ar crs %t.ar %t-coff.o
> RUN: not grep -q __.SYMDEF %t.ar
> RUN: llvm-ar crs %t.ar %t-macho.o
> RUN: not grep -q __.SYMDEF %t.ar
> -
> -RUN: rm -f %t.ar
> -Test that multiple dashed options works.
> -RUN: llvm-ar -c -r -s %t.ar %t-macho.o
> -RUN: grep -q __.SYMDEF %t.ar
> -Test with duplicated options.
> -RUN: llvm-ar -c -r -s -c -s %t.ar %t-coff.o
> -RUN: grep -q __.SYMDEF %t.ar
> +RUN: llvm-ar crs %t.ar %t-elf.o
> +RUN: not grep -q __.SYMDEF %t.ar
> 
> RUN: rm -f %t.ar
> Test with the options in a different order.
> RUN: llvm-ar rsc %t.ar %t-macho.o
> RUN: grep -q __.SYMDEF %t.ar
> -Test with options everywhere.
> -RUN: llvm-ar rsc -cs -sc %t.ar %t-coff.o -cs -sc
> -RUN: grep -q __.SYMDEF %t.ar
> -
> -Ensure that we select the existing format when updating.
> -
> 
> Added: llvm/trunk/test/tools/llvm-ar/delete.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/delete.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/delete.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/delete.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +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
> 
> Added: llvm/trunk/test/tools/llvm-ar/extract.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/extract.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/extract.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/extract.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +1,21 @@
> +## Test extract operation.
> +RUN: rm -rf %t && mkdir -p %t/extracted/
> +
> +# Extracting from an empty archive should not warn or error:
> +RUN: llvm-ar cr %t/empty.a
> +RUN: llvm-ar x %t/empty.a 2>&1 \
> +RUN:   | FileCheck --allow-empty /dev/null --implicit-check-not={{.}}
> +
> +RUN: echo filea > %t/a.txt
> +RUN: echo fileb > %t/b.txt
> +RUN: llvm-ar rc %t/archive.a %t/a.txt %t/b.txt
> +
> +# Single member:
> +RUN: cd %t/extracted && llvm-ar x %t/archive.a a.txt
> +RUN: diff %t/a.txt %t/extracted/a.txt 
> +
> +# All members:
> +RUN: rm %t/extracted/a.txt
> +RUN: cd %t/extracted && llvm-ar x %t/archive.a
> +RUN: diff %t/a.txt %t/extracted/a.txt 
> +RUN: diff %t/b.txt %t/extracted/b.txt 
> 
> Copied: llvm/trunk/test/tools/llvm-ar/insert-after.test (from r365316, llvm/trunk/test/tools/llvm-ar/insert-after.test)
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/insert-after.test?p2=llvm/trunk/test/tools/llvm-ar/insert-after.test&p1=llvm/trunk/test/tools/llvm-ar/insert-after.test&r1=365316&r2=365318&rev=365318&view=diff
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/insert-after.test (original)
> +++ llvm/trunk/test/tools/llvm-ar/insert-after.test Mon Jul  8 06:41:52 2019
> @@ -6,7 +6,7 @@ RUN: touch %t3.txt
> RUN: touch %t4.txt
> 
> # Insert one file:
> -RUN: rm -f %t-one.ar
> +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
> @@ -16,7 +16,7 @@ ONE-NEXT: 3.txt
> ONE-NEXT: 2.txt
> 
> # Insert file at back:
> -RUN: rm -f %t-back.ar
> +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
> @@ -26,18 +26,18 @@ BACK-NEXT: 2.txt
> BACK-NEXT: 3.txt
> 
> # Insert multiple files:
> -RUN: rm -f %t-multiple.ar
> +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: 3.txt
> MULTIPLE-NEXT: 4.txt
> +MULTIPLE-NEXT: 3.txt
> MULTIPLE-NEXT: 2.txt
> 
> # Insert after invalid file:
> -RUN: rm -f %t-invalid.ar
> +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
> @@ -49,7 +49,7 @@ INVALID-NEXT: 2.txt
> INVALID-NEXT: 3.txt
> 
> # Insert file at the same position:
> -RUN: rm -f %t-position.ar
> +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
> 
> Copied: llvm/trunk/test/tools/llvm-ar/insert-before.test (from r365316, llvm/trunk/test/tools/llvm-ar/insert-before.test)
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/insert-before.test?p2=llvm/trunk/test/tools/llvm-ar/insert-before.test&p1=llvm/trunk/test/tools/llvm-ar/insert-before.test&r1=365316&r2=365318&rev=365318&view=diff
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/insert-before.test (original)
> +++ llvm/trunk/test/tools/llvm-ar/insert-before.test Mon Jul  8 06:41:52 2019
> @@ -6,7 +6,7 @@ RUN: touch %t3.txt
> RUN: touch %t4.txt
> 
> # Insert one file:
> -RUN: rm -f %t-one.ar
> +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
> @@ -16,7 +16,7 @@ ONE-NEXT: 3.txt
> ONE-NEXT: 2.txt
> 
> # Insert file at front:
> -RUN: rm -f %t-front.ar
> +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
> @@ -26,18 +26,18 @@ FRONT-NEXT: 1.txt
> FRONT-NEXT: 2.txt
> 
> # Insert multiple files:
> -RUN: rm -f %t-multiple.ar
> +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: 3.txt
> MULTIPLE-NEXT: 4.txt
> +MULTIPLE-NEXT: 3.txt
> MULTIPLE-NEXT: 2.txt
> 
> # Insert before an invalid file:
> -RUN: rm -f %t-invalid.ar
> +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
> @@ -49,7 +49,7 @@ INVALID-NEXT: 2.txt
> INVALID-NEXT: 3.txt
> 
> # Insert file at the same position:
> -RUN: rm -f %t-position.ar
> +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
> 
> Added: llvm/trunk/test/tools/llvm-ar/move-after.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/move-after.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/move-after.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/move-after.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +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
> 
> Added: llvm/trunk/test/tools/llvm-ar/move-before.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/move-before.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/move-before.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/move-before.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +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
> 
> Added: llvm/trunk/test/tools/llvm-ar/symtab.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/symtab.test?rev=365318&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-ar/symtab.test (added)
> +++ llvm/trunk/test/tools/llvm-ar/symtab.test Mon Jul  8 06:41:52 2019
> @@ -0,0 +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
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/20ae5570/attachment.html>


More information about the llvm-commits mailing list