llvm-project/lld/test
Fangrui Song d054c7ee2e Add test utility 'extract'
See https://lists.llvm.org/pipermail/llvm-dev/2020-July/143373.html
"[llvm-dev] Multiple documents in one test file" for some discussions.

`extract part filename` splits the input file into multiple parts separated by
regex `^(.|//)--- ` and extract the specified part to stdout or the
output file (if specified).

Use case A (organizing input of different formats (e.g. linker
script+assembly) in one file).

```
// RUN: extract lds %s -o %t.lds
// RUN: extract asm %s -o %t.s
// RUN: llvm-mc %t.s -o %t.o
// RUN: ld.lld -T %t.lds %t.o -o %t
This is sometimes better than the %S/Inputs/ approach because the user
can see the auxiliary files immediately and don't have to open another file.
```

Use case B (for utilities which don't have built-in input splitting
feature):

```
// RUN: extract case1 %s | llc | FileCheck %s --check-prefix=CASE1
// RUN: extract case2 %s | llc | FileCheck %s --check-prefix=CASE2
Combing tests prudently can improve readability.
This is sometimes better than having multiple test files.
```

Since this is a new utility, there is no git history concerns for
UpperCase variable names. I use lowerCase variable names like mlir/lld.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D83834
2020-07-23 19:15:35 -07:00
..
COFF [LLD][COFF] Skip computation of the undefined symbols references that are not shown 2020-07-20 13:45:16 -04:00
ELF Add test utility 'extract' 2020-07-23 19:15:35 -07:00
MachO [lld-macho] Support binding dysyms to any section 2020-07-02 21:21:01 -07:00
MinGW [LLD] [MinGW] Implement the --file-alignment and --section-alignment options 2020-07-15 08:34:08 +03:00
Unit Revert "Temporarily revert "build: use `find_package(Python3)` if available"" 2020-04-29 01:38:08 +00:00
darwin [Darwin] Do not error on '-lto_library' option 2018-06-13 18:59:14 +00:00
mach-o ld64.lld: Make janky support for tbd files actually work sometimes 2020-07-02 15:31:21 -04:00
wasm [WebAssembly] 64-bit memory limits 2020-07-06 12:40:45 -07:00
CMakeLists.txt Add test utility 'extract' 2020-07-23 19:15:35 -07:00
lit.cfg.py Add test utility 'extract' 2020-07-23 19:15:35 -07:00
lit.site.cfg.py.in Revert "[CMake] Simplify CMake handling for zlib" 2020-07-23 15:12:42 -07:00