Skip to content

Commit 754b946

Browse files
authored
[lld] Support RUN_LLD_MAIN_TWICE for the ELF port (llvm#124441)
This enables the LLD_IN_TEST=2 testing mode for ``` path/to/llvm-lit -sv --param RUN_LLD_MAIN_TWICE=1 lld/test/ELF ``` When `Fatal` is called, `RunSafely` will return false. For the first invocation in LLD_IN_TEST=2 mode, `inTestOutputDisabled` is true and lld will not write to stdout/stderr, making many tests fail. (This essentially discourages `Fatal` calls in the source code.) Add XFAIL: main-run-twice to these tests similar to https://reviews.llvm.org/D112898 for Mach-O ``` comment="This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice." xargs </tmp/0 sed -Ei "1s/(;|#|\/\/) REQUIRES: .*/\0\n\1 "$comment"\n\1 XFAIL: main-run-twice/;t;1s/^/# "$comment"\n# XFAIL: main-run-twice\n/" ```
1 parent 1782168 commit 754b946

21 files changed

+42
-4
lines changed

lld/test/ELF/archive-thin-missing-member.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# REQUIRES: x86
2+
# This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
# XFAIL: main-run-twice
24

35
# RUN: rm -f %t-no-syms.a
46
# RUN: rm -f %t-syms.a

lld/test/ELF/arm-thumb-thunk-v6m-xo.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: arm
2+
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
// XFAIL: main-run-twice
24
// RUN: rm -rf %t && split-file %s %t
35
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv6m-none-eabi %t/a.s -o %t/a.o
46
// RUN: ld.lld --no-rosegment --script %t/a.t %t/a.o -o %t/a

lld/test/ELF/arm-thunk-section-too-large.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: arm
2+
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
// XFAIL: main-run-twice
24
// RUN: llvm-mc %s -triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj -o %t.o
35
// RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
46

lld/test/ELF/arm-thunk-toolargesection.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: arm
2+
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
// XFAIL: main-run-twice
24
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
35
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
46

lld/test/ELF/arm-v5-reloc-error.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: arm
2+
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
// XFAIL: main-run-twice
24
// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabi %s -o %t
35
// RUN: echo "SECTIONS { \
46
// RUN: . = SIZEOF_HEADERS; \

lld/test/ELF/bad-archive.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: x86
2+
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
// XFAIL: main-run-twice
24

35
// Check bad archive error reporting with --whole-archive
46
// and without it.

lld/test/ELF/fatlto/fatlto.invalid.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# REQUIRES: x86
2+
# This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
# XFAIL: main-run-twice
24
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
35
# RUN: not ld.lld %t -o /dev/null --fat-lto-objects 2>&1 | FileCheck %s
46

lld/test/ELF/invalid-cie-reference.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: x86
2+
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
// XFAIL: main-run-twice
24

35
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
46
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s

lld/test/ELF/invalid/comdat-broken.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# REQUIRES: x86
2+
# This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
# XFAIL: main-run-twice
24

35
# RUN: yaml2obj %s -o %t.o
46
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s

lld/test/ELF/invalid/data-encoding.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# REQUIRES: x86
2+
# This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
3+
# XFAIL: main-run-twice
24

35
# The object in the archive has invalid data encoding.
46
# Check we report this.

0 commit comments

Comments
 (0)