Skip to content

Commit 5617587

Browse files
boomanaiden154mahesh-attarde
authored andcommitted
[lld] Remove uses of %T from tests (llvm#150740)
%T has been deprecated for about seven years. It is to be avoided for the most part given it does not create a unique directory per test. So, remove it from lld tests with eventual intention of removing support from llvm-lit. Most of the cases in lld were not misusing the feature, using it to get the directory that the test objects were in or as a path to pass for -libpath. These cases all work perfectly well with a created directory however and allow for the removal of %T to prevent incorrect usage.
1 parent 34ced5c commit 5617587

File tree

6 files changed

+33
-25
lines changed

6 files changed

+33
-25
lines changed

lld/test/COFF/nodefaultlib.test

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# RUN: cp %p/Inputs/hello64.obj %T
2-
# RUN: cp %p/Inputs/std64.lib %T
1+
# RUN: mkdir -p %t.dir
2+
# RUN: cp %p/Inputs/hello64.obj %t.dir
3+
# RUN: cp %p/Inputs/std64.lib %t.dir
34

45
# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console \
56
# RUN: hello64.obj /defaultlib:std64.lib >& %t.log
@@ -9,12 +10,12 @@
910
# RUN: hello64 /defaultlib:std64.lib >& %t.log
1011
# RUN: FileCheck -DMSG=%errc_ENOENT -check-prefix=CHECK2 %s < %t.log
1112

12-
# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
13+
# RUN: lld-link /libpath:%t.dir /out:%t.exe /entry:main \
1314
# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib \
1415
# RUN: /nodefaultlib:std64.lib >& %t.log || true
1516
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log
1617

17-
# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
18+
# RUN: lld-link /libpath:%t.dir /out:%t.exe /entry:main \
1819
# RUN: /subsystem:console hello64.obj /defaultlib:std64 \
1920
# RUN: /nodefaultlib:std64.lib >& %t.log || true
2021
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log
@@ -24,10 +25,10 @@ CHECK2: error: could not open 'hello64': [[MSG]]
2425
CHECK3: error: undefined symbol: MessageBoxA
2526
CHECK3-NEXT: >>> referenced by {{.*}}hello64.obj:(main)
2627

27-
# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
28+
# RUN: lld-link /libpath:%t.dir /out:%t.exe /entry:main \
2829
# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib
2930

30-
# RUN: env LIB=%T lld-link /out:%t.exe /entry:main \
31+
# RUN: env LIB=%t.dir lld-link /out:%t.exe /entry:main \
3132
# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib
3233

3334
MSVC stamps uppercase references in OBJ directives, thus ensure that passing lowercase 'libcmt' and 'oldnames' to /nodefaultlib works.
@@ -37,11 +38,11 @@ MSVC stamps uppercase references in OBJ directives, thus ensure that passing low
3738
UPPERCASE-NOT: OLDNAMES
3839
UPPERCASE-NOT: LIBCMT
3940

40-
# RUN: yaml2obj -o %T/defaultlib.obj %p/Inputs/defaultlib.yaml
41+
# RUN: yaml2obj -o %t.dir/defaultlib.obj %p/Inputs/defaultlib.yaml
4142
# RUN: mkdir -p %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
4243
# RUN: cp %p/Inputs/ret42.lib %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64/default.lib
4344

44-
# RUN: lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console %T/defaultlib.obj
45-
# RUN: not lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console /nodefaultlib:default.lib %T/defaultlib.obj 2>&1 | FileCheck -check-prefix=CHECK4 %s
45+
# RUN: lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console %t.dir/defaultlib.obj
46+
# RUN: not lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console /nodefaultlib:default.lib %t.dir/defaultlib.obj 2>&1 | FileCheck -check-prefix=CHECK4 %s
4647

4748
CHECK4: error: <root>: undefined symbol: main

lld/test/COFF/pdb-options.test

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
; If /DEBUG is specified but not /pdb, it uses a default name in the current
2020
; directory. This is a bit hacky since but we need to be IN our test specific
2121
; temporary directory when we run this command or we can't test this
22-
# RUN: cd %T
23-
# RUN: lld-link /DEBUG /entry:main /nodefaultlib %t1.obj %t2.obj
24-
# RUN: ls %t1.pdb
25-
# RUN: rm %t*
26-
# RUN: cd %T/..
22+
# RUN: mkdir -p %t.dir
23+
# RUN: cp %t1.obj %t.dir/1.obj
24+
# RUN: cp %t2.obj %t.dir/2.obj
25+
# RUN: cd %t.dir
26+
# RUN: lld-link /DEBUG /entry:main /nodefaultlib %t.dir/1.obj %t.dir/2.obj
27+
# RUN: ls %t.dir/1.pdb
28+
# RUN: rm -r %t*

lld/test/COFF/pdb-type-server-invalid-signature.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
# VALID-SIGNATURE-NOT: The signature does not match; the file(s) might be out of date
2020

2121
# Test an invalid path reference to a PDB type server; as a fallback LLD should try to load the PDB in the same path as the OBJ
22-
# RUN: yaml2obj %S/Inputs/pdb-type-server-invalid-path.yaml -o %t3.obj
23-
# RUN: cp %S/Inputs/pdb-diff-cl.pdb %T
24-
# RUN: lld-link %t3.obj -out:%t3.exe -debug -pdb:%t3.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID-PATH -allow-empty
22+
# RUN: mkdir -p %t.dir
23+
# RUN: yaml2obj %S/Inputs/pdb-type-server-invalid-path.yaml -o %t.dir/3.obj
24+
# RUN: cp %S/Inputs/pdb-diff-cl.pdb %t.dir/pdb-diff-cl.pdb
25+
# RUN: lld-link %t.dir/3.obj -out:%t3.exe -debug -pdb:%t3.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID-PATH -allow-empty
2526

2627
# INVALID-PATH-NOT: warning: Cannot use debug info for '{{.*}}3.obj' [LNK4099]
2728
# INVALID-PATH-NOT: failed to load reference 'c:\some_invalid_path_AABB98765\pdb-diff-cl.pdb': [[MSG]]

lld/test/COFF/wrap-lto-2.ll

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,30 @@
2323
;; the wrapped symbol, when LTO or ThinLTO is involved. It checks for various
2424
;; combinations of bitcode and regular objects.
2525

26+
; RUN: mkdir -p %t.dir
27+
2628
;; LTO + LTO
27-
; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
29+
; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%t.dir %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
2830
; RUN: llvm-objdump -d %t.bc-bc.exe | FileCheck %s --check-prefixes=CHECK,JMP
2931

3032
;; LTO + Object
31-
; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
33+
; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%t.dir %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
3234
; RUN: llvm-objdump -d %t.bc-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP
3335

3436
;; Object + LTO
35-
; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
37+
; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%t.dir %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
3638
; RUN: llvm-objdump -d %t.obj-bc.exe | FileCheck %s --check-prefixes=CHECK,CALL
3739

3840
;; ThinLTO + ThinLTO
39-
; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
41+
; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%t.dir %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
4042
; RUN: llvm-objdump -d %t.thin-thin.exe | FileCheck %s --check-prefixes=CHECK,JMP
4143

4244
;; ThinLTO + Object
43-
; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
45+
; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%t.dir %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
4446
; RUN: llvm-objdump -d %t.thin-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP
4547

4648
;; Object + ThinLTO
47-
; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
49+
; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%t.dir %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
4850
; RUN: llvm-objdump -d %t.obj-thin.exe | FileCheck %s --check-prefixes=CHECK,CALL
4951

5052
;; Make sure that calls in entry() are not eliminated and that bar is

lld/test/COFF/wrap-with-archive.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// RUN: rm -f %t.lib
77
// RUN: llvm-ar rcs %t.lib %t.wrap.obj %t.other.obj
88

9-
// RUN: lld-link -out:%t.exe %t.main.obj -libpath:%T %t.lib -entry:entry -subsystem:console -wrap:foo
9+
// RUN: mkdir -p %t.dir
10+
// RUN: lld-link -out:%t.exe %t.main.obj -libpath:%t.dir %t.lib -entry:entry -subsystem:console -wrap:foo
1011

1112
// Note: No real definition of foo exists here, but that works fine as long
1213
// as there's no actual references to __real_foo.

lld/test/wasm/lto/save-temps.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
; RUN: cd %T
1+
; RUN: mkdir -p %t.dir
2+
; RUN: cd %t.dir
23
; RUN: rm -f a.out a.out.lto.bc a.out.lto.o
34
; RUN: llvm-as %s -o %t.o
45
; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o

0 commit comments

Comments
 (0)