llvm-project/lld/test/ELF/bad-archive.s
Fangrui Song 754b94638e
[lld] Support RUN_LLD_MAIN_TWICE for the ELF port (#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/"
```
2025-01-27 10:04:57 -08:00

17 lines
721 B
ArmAsm

// REQUIRES: x86
// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.
// XFAIL: main-run-twice
// Check bad archive error reporting with --whole-archive
// and without it.
// RUN: echo "!<arch>" > %t.a
// RUN: echo "foo" >> %t.a
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: not ld.lld %t.o %t.a -o /dev/null 2>&1 | FileCheck -DFILE=%t.a %s
// RUN: not ld.lld %t.o --whole-archive %t.a -o /dev/null 2>&1 | FileCheck -DFILE=%t.a %s
// CHECK: error: [[FILE]]: failed to parse archive: truncated or malformed archive (remaining size of archive too small for next archive member header at offset 8)
.globl _start
_start: