[lld] r338705 - [lld] Make tests calling llvm-ar more robust
Chris Jackson via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 2 04:33:55 PDT 2018
Author: chrisj
Date: Thu Aug 2 04:33:54 2018
New Revision: 338705
URL: http://llvm.org/viewvc/llvm-project?rev=338705&view=rev
Log:
[lld] Make tests calling llvm-ar more robust
Some lit tests that call llvm-ar use the 'r' flag. If the target archive
already exists and is in a corrupt state, this can cause the test to fail. We
have added 'rm -f' calls before the llvm-ar calls to increase the
robustness of the tests.
Differential revision: https://reviews.llvm.org/D49184
Modified:
lld/trunk/test/COFF/export-all.s
lld/trunk/test/COFF/lto-chkstk.ll
lld/trunk/test/COFF/wholearchive.s
lld/trunk/test/ELF/conflict.s
lld/trunk/test/ELF/gnu-hash-table.s
lld/trunk/test/ELF/incompatible-ar-first.s
lld/trunk/test/ELF/incompatible.s
lld/trunk/test/ELF/linkerscript/filename-spec.s
lld/trunk/test/ELF/linkerscript/lazy-symbols.test
lld/trunk/test/ELF/no-obj.s
lld/trunk/test/ELF/tls-in-archive.s
lld/trunk/test/ELF/tls-weak-undef.s
lld/trunk/test/ELF/trace-ar.s
lld/trunk/test/ELF/trace-symbols.s
lld/trunk/test/ELF/undef.s
lld/trunk/test/ELF/version-exclude-libs.s
lld/trunk/test/wasm/archive.ll
lld/trunk/test/wasm/load-undefined.test
lld/trunk/test/wasm/visibility-hidden.ll
Modified: lld/trunk/test/COFF/export-all.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/export-all.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/COFF/export-all.s (original)
+++ lld/trunk/test/COFF/export-all.s Thu Aug 2 04:33:54 2018
@@ -63,6 +63,7 @@ __imp__unexported:
# RUN: mkdir -p %T/libs
# RUN: echo -e ".global mingwfunc\n.text\nmingwfunc:\nret\n" > %T/libs/mingwfunc.s
# RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/mingwfunc.s -filetype=obj -o %T/libs/mingwfunc.o
+# RUN: rm -f %T/libs/libmingwex.a
# RUN: llvm-ar rcs %T/libs/libmingwex.a %T/libs/mingwfunc.o
# RUN: echo -e ".global crtfunc\n.text\ncrtfunc:\nret\n" > %T/libs/crtfunc.s
# RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/crtfunc.s -filetype=obj -o %T/libs/crt2.o
Modified: lld/trunk/test/COFF/lto-chkstk.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/lto-chkstk.ll?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/COFF/lto-chkstk.ll (original)
+++ lld/trunk/test/COFF/lto-chkstk.ll Thu Aug 2 04:33:54 2018
@@ -2,6 +2,7 @@
; RUN: llvm-as -o %t.obj %s
; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %T/lto-chkstk-foo.obj %S/Inputs/lto-chkstk-foo.s
; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %T/lto-chkstk-chkstk.obj %S/Inputs/lto-chkstk-chkstk.s
+; RUN: rm -f %t.lib
; RUN: llvm-ar cru %t.lib %T/lto-chkstk-chkstk.obj
; RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj %T/lto-chkstk-foo.obj %t.lib
Modified: lld/trunk/test/COFF/wholearchive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/wholearchive.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/COFF/wholearchive.s (original)
+++ lld/trunk/test/COFF/wholearchive.s Thu Aug 2 04:33:54 2018
@@ -1,6 +1,7 @@
# REQUIRES: x86
# RUN: yaml2obj < %p/Inputs/export.yaml > %t.archive.obj
+# RUN: rm -f %t.archive.lib
# RUN: llvm-ar rcs %t.archive.lib %t.archive.obj
# RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.main.obj
Modified: lld/trunk/test/ELF/conflict.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/conflict.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/conflict.s (original)
+++ lld/trunk/test/ELF/conflict.s Thu Aug 2 04:33:54 2018
@@ -26,6 +26,7 @@
# RUN: FileCheck -check-prefix=DEMANGLE %s
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/conflict.s -o %t2.o
+# RUN: rm -f %t3.a
# RUN: llvm-ar rcs %t3.a %t2.o
# RUN: not ld.lld %t1.o %t3.a -u baz -o %t2 2>&1 | FileCheck -check-prefix=ARCHIVE %s
Modified: lld/trunk/test/ELF/gnu-hash-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-hash-table.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-hash-table.s (original)
+++ lld/trunk/test/ELF/gnu-hash-table.s Thu Aug 2 04:33:54 2018
@@ -13,7 +13,7 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %t2.s -o %t2-ppc64le.o
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %t2.s -o %t2-ppc64.o
-# RUN: rm -f %t2-i386.a %t2-x86_64.a %t2-ppc64.a
+# RUN: rm -f %t2-i386.a %t2-x86_64.a %t2-ppc64.a %t2-ppc64le.a
# RUN: llvm-ar rc %t2-i386.a %t2-i386.o
# RUN: llvm-ar rc %t2-x86_64.a %t2-x86_64.o
# RUN: llvm-ar rc %t2-ppc64le.a %t2-ppc64le.o
Modified: lld/trunk/test/ELF/incompatible-ar-first.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/incompatible-ar-first.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/incompatible-ar-first.s (original)
+++ lld/trunk/test/ELF/incompatible-ar-first.s Thu Aug 2 04:33:54 2018
@@ -1,5 +1,6 @@
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/archive.s -o %ta.o
+// RUN: rm -f %t.a
// RUN: llvm-ar rc %t.a %ta.o
// RUN: llvm-mc -filetype=obj -triple=i686-linux %s -o %tb.o
// RUN: not ld.lld %t.a %tb.o -o /dev/null 2>&1 | FileCheck %s
Modified: lld/trunk/test/ELF/incompatible.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/incompatible.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/incompatible.s (original)
+++ lld/trunk/test/ELF/incompatible.s Thu Aug 2 04:33:54 2018
@@ -48,6 +48,7 @@
// We used to fail to identify this incompatibility and crash trying to
// read a 64 bit file as a 32 bit one.
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/archive2.s -o %ta.o
+// RUN: rm -f %t.a
// RUN: llvm-ar rc %t.a %ta.o
// RUN: llvm-mc -filetype=obj -triple=i686-linux %s -o %tb.o
// RUN: not ld.lld %t.a %tb.o 2>&1 -o %t | FileCheck --check-prefix=ARCHIVE %s
Modified: lld/trunk/test/ELF/linkerscript/filename-spec.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/filename-spec.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/filename-spec.s (original)
+++ lld/trunk/test/ELF/linkerscript/filename-spec.s Thu Aug 2 04:33:54 2018
@@ -43,6 +43,7 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.testdir1/filename-spec1.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
# RUN: %p/Inputs/filename-spec.s -o %t.testdir2/filename-spec2.o
+# RUN: rm -f %t.testdir1/lib1.a %t.testdir2/lib2.a
# RUN: llvm-ar rsc %t.testdir1/lib1.a %t.testdir1/filename-spec1.o
# RUN: llvm-ar rsc %t.testdir2/lib2.a %t.testdir2/filename-spec2.o
Modified: lld/trunk/test/ELF/linkerscript/lazy-symbols.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/lazy-symbols.test?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/lazy-symbols.test (original)
+++ lld/trunk/test/ELF/linkerscript/lazy-symbols.test Thu Aug 2 04:33:54 2018
@@ -1,5 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/lazy-symbols.s -o %t1
+# RUN: rm -f %tar
# RUN: llvm-ar rcs %tar %t1
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t2
# RUN: ld.lld %t2 %tar --script %s -o %tout
Modified: lld/trunk/test/ELF/no-obj.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/no-obj.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/no-obj.s (original)
+++ lld/trunk/test/ELF/no-obj.s Thu Aug 2 04:33:54 2018
@@ -1,5 +1,6 @@
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: rm -f %t.a
// RUN: llvm-ar rcs %t.a %t.o
// RUN: not ld.lld -o /dev/null -u _start %t.a 2>&1 | FileCheck %s
Modified: lld/trunk/test/ELF/tls-in-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls-in-archive.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/tls-in-archive.s (original)
+++ lld/trunk/test/ELF/tls-in-archive.s Thu Aug 2 04:33:54 2018
@@ -1,5 +1,6 @@
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-in-archive.s -o %t1.o
+// RUN: rm -f %t.a
// RUN: llvm-ar cru %t.a %t1.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
// RUN: ld.lld %t2.o %t.a -o /dev/null
Modified: lld/trunk/test/ELF/tls-weak-undef.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls-weak-undef.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/tls-weak-undef.s (original)
+++ lld/trunk/test/ELF/tls-weak-undef.s Thu Aug 2 04:33:54 2018
@@ -4,6 +4,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux \
// RUN: %p/Inputs/tls-in-archive.s -o %t1.o
+// RUN: rm -f %t.a
// RUN: llvm-ar cru %t.a %t1.o
// RUN: ld.lld %t.o %t.a -o %t
Modified: lld/trunk/test/ELF/trace-ar.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/trace-ar.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/trace-ar.s (original)
+++ lld/trunk/test/ELF/trace-ar.s Thu Aug 2 04:33:54 2018
@@ -2,6 +2,7 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.foo.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/trace-ar1.s -o %t.obj1.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/trace-ar2.s -o %t.obj2.o
+# RUN: rm -f %t.boo.a
# RUN: llvm-ar rcs %t.boo.a %t.obj1.o %t.obj2.o
## Check how -t works with achieves
Modified: lld/trunk/test/ELF/trace-symbols.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/trace-symbols.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/trace-symbols.s (original)
+++ lld/trunk/test/ELF/trace-symbols.s Thu Aug 2 04:33:54 2018
@@ -8,7 +8,9 @@
# RUN: %p/Inputs/trace-symbols-foo-strong.s -o %t2
# RUN: ld.lld -shared %t1 -o %t1.so
# RUN: ld.lld -shared %t2 -o %t2.so
+# RUN: rm -f %t1.a
# RUN: llvm-ar rcs %t1.a %t1
+# RUN: rm -f %t2.a
# RUN: llvm-ar rcs %t2.a %t2
# RUN: ld.lld -y foo -trace-symbol common -trace-symbol=hsymbol \
Modified: lld/trunk/test/ELF/undef.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/undef.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/undef.s (original)
+++ lld/trunk/test/ELF/undef.s Thu Aug 2 04:33:54 2018
@@ -3,6 +3,7 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef.s -o %t2.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-debug.s -o %t3.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-bad-debug.s -o %t4.o
+# RUN: rm -f %t2.a
# RUN: llvm-ar rc %t2.a %t2.o
# RUN: not ld.lld %t.o %t2.a %t3.o %t4.o -o %t.exe 2>&1 | FileCheck %s
# RUN: not ld.lld -pie %t.o %t2.a %t3.o %t4.o -o %t.exe 2>&1 | FileCheck %s
Modified: lld/trunk/test/ELF/version-exclude-libs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-exclude-libs.s?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/ELF/version-exclude-libs.s (original)
+++ lld/trunk/test/ELF/version-exclude-libs.s Thu Aug 2 04:33:54 2018
@@ -1,5 +1,6 @@
// REQUIRES: x86
// RUN: llvm-mc %p/Inputs/versiondef.s -o %t.o -filetype=obj -triple=x86_64-pc-linux
+// RUN: rm -f %t.a
// RUN: llvm-ar -r %t.a %t.o
// RUN: llvm-mc %s -o %t2.o -filetype=obj -triple=x86_64-pc-linux
// RUN: ld.lld %t2.o %t.a --shared --exclude-libs ALL -o %t.so
Modified: lld/trunk/test/wasm/archive.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/archive.ll?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/wasm/archive.ll (original)
+++ lld/trunk/test/wasm/archive.ll Thu Aug 2 04:33:54 2018
@@ -3,6 +3,7 @@
; RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o
; RUN: llc -filetype=obj %S/Inputs/archive3.ll -o %t.a3.o
; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.hello.o
+; RUN: rm -f %t.a
; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o %t.hello.o
; RUN: rm -f %t.imports
; RUN: not wasm-ld %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED %s
Modified: lld/trunk/test/wasm/load-undefined.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/load-undefined.test?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/wasm/load-undefined.test (original)
+++ lld/trunk/test/wasm/load-undefined.test Thu Aug 2 04:33:54 2018
@@ -4,6 +4,7 @@
; RUN: llc -filetype=obj %S/Inputs/ret64.ll -o %t.o
; RUN: llc -filetype=obj %S/Inputs/ret32.ll -o %t2.o
; RUN: llc -filetype=obj %S/Inputs/start.ll -o %t.start.o
+; RUN: rm -f %t2.a
; RUN: llvm-ar rcs %t2.a %t2.o
; RUN: wasm-ld %t.start.o --no-gc-sections %t2.a %t.o -o %t.wasm -u ret32 --undefined ret64
; RUN: obj2yaml %t.wasm | FileCheck %s
Modified: lld/trunk/test/wasm/visibility-hidden.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/visibility-hidden.ll?rev=338705&r1=338704&r2=338705&view=diff
==============================================================================
--- lld/trunk/test/wasm/visibility-hidden.ll (original)
+++ lld/trunk/test/wasm/visibility-hidden.ll Thu Aug 2 04:33:54 2018
@@ -1,5 +1,6 @@
; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/hidden.ll -o %t2.o
+; RUN: rm -f %t2.a
; RUN: llvm-ar rcs %t2.a %t2.o
; RUN: wasm-ld %t.o %t2.a -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
More information about the llvm-commits
mailing list