Skip to content

Commit db8dad2

Browse files
committed
[ELF][test] Change references of %T to %t.dir
Test files in the same directory share the same %T. %T is easy to misuse and cause race conditions (when running concurrently) so it has been deprecated since D48842 (see docs/CommandGuide/lit.rst). While here, add `rm -rf %t.dir` so that tests cannot depend on old files lying around. Reviewed By: jhenderson, ruiu Differential Revision: https://reviews.llvm.org/D69572
1 parent 14e289e commit db8dad2

11 files changed

+57
-50
lines changed

lld/test/ELF/linkerscript/filename-spec.s

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@
2525
# RUN: ld.lld -o %t4 --script %t4.script %tx.o %ty.o
2626
# RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=SECONDFIRST %s
2727

28-
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %T/filename-spec1.o
28+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
29+
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/filename-spec1.o
2930
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
30-
# RUN: %p/Inputs/filename-spec.s -o %T/filename-spec2.o
31+
# RUN: %p/Inputs/filename-spec.s -o %t.dir/filename-spec2.o
3132

32-
# RUN: echo "SECTIONS{.foo :{ %/T/filename-spec2.o(.foo) %/T/filename-spec1.o(.foo) }}" > %t5.script
33+
# RUN: echo "SECTIONS{.foo :{ %/t.dir/filename-spec2.o(.foo) %/t.dir/filename-spec1.o(.foo) }}" > %t5.script
3334
# RUN: ld.lld -o %t5 --script %t5.script \
34-
# RUN: %/T/filename-spec1.o %/T/filename-spec2.o
35+
# RUN: %/t.dir/filename-spec1.o %/t.dir/filename-spec2.o
3536
# RUN: llvm-objdump -s %t5 | FileCheck --check-prefix=SECONDFIRST %s
3637

37-
# RUN: echo "SECTIONS{.foo :{ %/T/filename-spec1.o(.foo) %/T/filename-spec2.o(.foo) }}" > %t6.script
38+
# RUN: echo "SECTIONS{.foo :{ %/t.dir/filename-spec1.o(.foo) %/t.dir/filename-spec2.o(.foo) }}" > %t6.script
3839
# RUN: ld.lld -o %t6 --script %t6.script \
39-
# RUN: %/T/filename-spec1.o %/T/filename-spec2.o
40+
# RUN: %/t.dir/filename-spec1.o %/t.dir/filename-spec2.o
4041
# RUN: llvm-objdump -s %t6 | FileCheck --check-prefix=FIRSTY %s
4142

4243
# RUN: mkdir -p %t.testdir1 %t.testdir2

lld/test/ELF/linkerscript/linker-script-in-search-path.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
# This behaviour matches ld.bfd and various projects appear to rely on this
44

55
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
6-
# RUN: mkdir -p %T/searchpath
7-
# RUN: echo 'OUTPUT("%t.out")' > %T/searchpath/%basename_t.script
8-
# RUN: ld.lld -T%T/searchpath/%basename_t.script %t.o
6+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
7+
# RUN: echo 'OUTPUT("%t.out")' > %t.dir/script
8+
# RUN: ld.lld -T%t.dir/script %t.o
99
# RUN: llvm-readobj %t.out | FileCheck %s
1010
# CHECK: Format: ELF64-x86-64
1111

1212
# If the linker script specified with -T is missing we should emit an error
13-
# RUN: not ld.lld -T%basename_t.script %t.o 2>&1 | FileCheck %s -check-prefix ERROR
14-
# ERROR: error: cannot find linker script {{.*}}.script
13+
# RUN: not ld.lld -Tscript %t.o 2>&1 | FileCheck %s -check-prefix ERROR
14+
# ERROR: error: cannot find linker script {{.*}}script
1515

1616
# But if it exists in the search path we should fall back to that instead:
1717
# RUN: rm %t.out
18-
# RUN: ld.lld -L %T/searchpath -T%basename_t.script %t.o
18+
# RUN: ld.lld -L %t.dir -Tscript %t.o
1919
# RUN: llvm-readobj %t.out | FileCheck %s

lld/test/ELF/linkerscript/linkerscript.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
# RUN: ld.lld %t.script1 -o %t.out
3434
# RUN: llvm-readobj %t2 > /dev/null
3535

36+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
3637
# RUN: echo "INCLUDE \"foo.script\"" > %t.script
37-
# RUN: echo "OUTPUT(\"%t.out\")" > %T/foo.script
38+
# RUN: echo "OUTPUT(\"%t.out\")" > %t.dir/foo.script
3839
# RUN: not ld.lld %t.script -o %t.out > %t.log 2>&1
3940
# RUN: FileCheck -check-prefix=INCLUDE_ERR %s < %t.log
4041
# INCLUDE_ERR: error: {{.+}}.script:1: cannot find linker script foo.script
4142
# INCLUDE_ERR-NEXT: INCLUDE "foo.script"
42-
# RUN: ld.lld -L %T %t.script %t
43+
# RUN: ld.lld -L %t.dir %t.script %t
4344

4445
# RUN: echo "FOO(BAR)" > %t.script
4546
# RUN: not ld.lld -o %t.out %t.script > %t.log 2>&1

lld/test/ELF/linkerscript/memory-include.test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
# RUN: echo '.section .data,"aw"; .quad 0' >> %t.s
55
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o
66

7-
# RUN: echo "RAM2 (rwx): ORIGIN = 0x3000, LENGTH = 0x100" > %t.inc
8-
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
7+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
8+
# RUN: echo "RAM2 (rwx): ORIGIN = 0x3000, LENGTH = 0x100" > %t.dir/inc.script
9+
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
910
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s
1011
# CHECK: .data 00000008 0000000000002000 DATA
1112
# CHECK: .data2 00000008 0000000000003000 DATA
1213

1314
MEMORY {
1415
ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100
1516
RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100
16-
INCLUDE "memory-include.test.tmp.inc"
17+
INCLUDE "inc.script"
1718
}
1819

1920
SECTIONS {

lld/test/ELF/linkerscript/output-section-include.test

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o
66

77
## Empty include file.
8-
# RUN: echo "" > %t.inc
9-
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
8+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
9+
# RUN: echo "" > %t.dir/inc.script
10+
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
1011
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1
1112
# CHECK1: .data 00000008 0000000000002000 DATA
1213

1314
## Non-empty include file.
14-
# RUN: echo "QUAD(0)" > %t.inc
15-
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
15+
# RUN: echo "QUAD(0)" > %t.dir/inc.script
16+
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
1617
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2
1718
# CHECK2: .data 00000010 0000000000002000 DATA
1819

@@ -25,6 +26,6 @@ SECTIONS {
2526
.text : { *(.text*) } > ROM
2627
.data : {
2728
*(.data*)
28-
INCLUDE "output-section-include.test.tmp.inc"
29+
INCLUDE "inc.script"
2930
} > RAM
3031
}

lld/test/ELF/linkerscript/section-include.test

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o
66

77
## Empty include file.
8-
# RUN: echo "" > %t.inc
9-
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
8+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
9+
# RUN: echo "" > %t.dir/inc.script
10+
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
1011
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1
1112
# CHECK1: .data 00000008 0000000000002000 DATA
1213
# CHECK1-NEXT: .data3 00000008 0000000000002008 DATA
1314

1415
## Non-empty include file.
15-
# RUN: echo ".data2 : { QUAD(0) } > RAM" > %t.inc
16-
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
16+
# RUN: echo ".data2 : { QUAD(0) } > RAM" > %t.dir/inc.script
17+
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
1718
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2
1819
# CHECK2: .data 00000008 0000000000002000 DATA
1920
# CHECK2-NEXT: .data2 00000008 0000000000002008 DATA
@@ -27,6 +28,6 @@ MEMORY {
2728
SECTIONS {
2829
.text : { *(.text*) } > ROM
2930
.data : { *(.data*) } > RAM
30-
INCLUDE "section-include.test.tmp.inc"
31+
INCLUDE "inc.script"
3132
.data3 : { QUAD(0) } > RAM
3233
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
; REQUIRES: x86
2-
; RUN: cd %T
2+
; RUN: rm -rf %t.dir && mkdir -p %t.dir
3+
; RUN: cd %t.dir
34
; RUN: rm -f a.out a.out.lto.bc a.out.lto.o
4-
; RUN: llvm-as %s -o %t.o
5-
; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o
6-
; RUN: ld.lld -shared %t.o %t2.o -save-temps
5+
; RUN: llvm-as %s -o t.o
6+
; RUN: llvm-as %p/Inputs/save-temps.ll -o t2.o
7+
; RUN: ld.lld -shared t.o t2.o -save-temps
78
; RUN: llvm-nm a.out | FileCheck %s
89
; RUN: llvm-nm a.out.0.0.preopt.bc | FileCheck %s
910
; RUN: llvm-nm a.out.lto.o | FileCheck %s
1011
; RUN: llvm-dis a.out.0.0.preopt.bc
1112

1213
; RUN: rm -f a.out a.out.lto.bc a.out.lto.o
13-
; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o --plugin-opt=save-temps
14+
; RUN: ld.lld -shared -m elf_x86_64 t.o t2.o --plugin-opt=save-temps
1415
; RUN: llvm-nm a.out | FileCheck %s
1516
; RUN: llvm-nm a.out.0.0.preopt.bc | FileCheck %s
1617
; RUN: llvm-nm a.out.lto.o | FileCheck %s

lld/test/ELF/lto/thinlto-debug-fission.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
; REQUIRES: x86
22

33
; RUN: opt %s -o %t1.o
4-
; RUN: rm -rf %T/dwo
4+
; RUN: rm -rf %t.dir
55

66
; Test to ensure that --plugin-opt=dwo_dir=$DIR creates .dwo files under $DIR
7-
; RUN: ld.lld --plugin-opt=dwo_dir=%T/dwo -shared %t1.o -o /dev/null
8-
; RUN: llvm-readobj -h %T/dwo/0.dwo | FileCheck %s
7+
; RUN: ld.lld --plugin-opt=dwo_dir=%t.dir -shared %t1.o -o /dev/null
8+
; RUN: llvm-readobj -h %t.dir/0.dwo | FileCheck %s
99

1010
; CHECK: Format: ELF64-x86-64
1111

lld/test/ELF/no-soname.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
// REQUIRES: x86
22
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3-
// RUN: mkdir -p %T/no-soname
4-
// RUN: ld.lld %t.o -shared -o %T/no-soname/libfoo.so
3+
// RUN: rm -rf %t.dir && mkdir -p %t.dir/no-soname
4+
// RUN: ld.lld %t.o -shared -o %t.dir/no-soname/libfoo.so
55

6-
// RUN: ld.lld %t.o %T/no-soname/libfoo.so -o %t
6+
// RUN: ld.lld %t.o %t.dir/no-soname/libfoo.so -o %t
77
// RUN: llvm-readobj --dynamic-table %t | FileCheck %s
88

99
// CHECK: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/libfoo.so]
1010
// CHECK-NOT: NEEDED
1111

12-
// RUN: ld.lld %t.o %T/no-soname/../no-soname/libfoo.so -o %t
12+
// RUN: ld.lld %t.o %t.dir/no-soname/../no-soname/libfoo.so -o %t
1313
// RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK2
1414

1515
// CHECK2: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/../no-soname/libfoo.so]
1616
// CHECK2-NOT: NEEDED
1717

18-
// RUN: ld.lld %t.o -L%T/no-soname/../no-soname -lfoo -o %t
18+
// RUN: ld.lld %t.o -L%t.dir/no-soname/../no-soname -lfoo -o %t
1919
// RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK3
2020

2121
// CHECK3: 0x0000000000000001 NEEDED Shared library: [libfoo.so]
2222
// CHECK3-NOT: NEEDED
2323

24-
// RUN: ld.lld %t.o -shared -soname libbar.so -o %T/no-soname/libbar.so
25-
// RUN: ld.lld %t.o %T/no-soname/libbar.so -o %t
24+
// RUN: ld.lld %t.o -shared -soname libbar.so -o %t.dir/no-soname/libbar.so
25+
// RUN: ld.lld %t.o %t.dir/no-soname/libbar.so -o %t
2626
// RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK4
2727

2828
// CHECK4: 0x0000000000000001 NEEDED Shared library: [libbar.so]

lld/test/ELF/reproduce-backslash.s

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# REQUIRES: x86, shell
1+
# REQUIRES: x86, system-linux
22

33
# Test that we don't erroneously replace \ with / on UNIX, as it's
44
# legal for a filename to contain backslashes.
5-
# RUN: llvm-mc %s -o %T/foo\\.o -filetype=obj -triple=x86_64-pc-linux
6-
# RUN: ld.lld %T/foo\\.o --reproduce %T/repro.tar -o /dev/null
7-
# RUN: tar tf %T/repro.tar | FileCheck %s
5+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
6+
# RUN: llvm-mc %s -o %t.dir/foo\\.o -filetype=obj -triple=x86_64-pc-linux
7+
# RUN: ld.lld %t.dir/foo\\.o --reproduce %t.dir/repro.tar -o /dev/null
8+
# RUN: tar tf %t.dir/repro.tar | FileCheck %s
89

910
# CHECK: repro/{{.*}}/foo\{{[\]?}}.o

lld/test/ELF/version-script-in-search-path.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# This behaviour matches ld.bfd.
44

55
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
6-
# RUN: mkdir -p %T/searchpath
7-
# RUN: echo '{};' > %T/searchpath/%basename_t.script
8-
# RUN: ld.lld -L%T/searchpath --version-script=%basename_t.script %t.o -o /dev/null
9-
# RUN: not ld.lld --version-script=%basename_t.script %t.o 2>&1 | FileCheck -check-prefix ERROR %s
6+
# RUN: rm -rf %t.dir && mkdir -p %t.dir
7+
# RUN: echo '{};' > %t.dir/script
8+
# RUN: ld.lld -L%t.dir --version-script=script %t.o -o /dev/null
9+
# RUN: not ld.lld --version-script=script %t.o 2>&1 | FileCheck -check-prefix ERROR %s
1010
# ERROR: error: cannot find version script

0 commit comments

Comments
 (0)