<div dir="ltr"><div>(+Richard - it's handy to include folks from previous discussions explicitly so everyone can more easily keep track of the conversation)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 13, 2020 at 6:17 PM Fangrui Song via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Sometimes it is convenient if we can specify multiple independent tests<br>
in one file. To give an example, let's discuss test/MC/ELF/debug-md5.s and<br>
test/MC/ELF/debug-md5-err.s (.file directive in the assembler).<br>
<br>
a) An invalid .file makes the whole file invalid. Because errors lead to a<br>
non-zero exit code, We have to use `RUN: not llvm-mc %s` for the whole file.<br>
This often lead to users placing good (`RUN: llvm-mc %s`) and bad tests (`RUN:<br>
not llvm-mc %s`) separately. For some features, having both good and bad tests<br>
in one file may improve readability.<br>
b) .debug_line is a global resource. Whenever we add a (valid) .file, we<br>
contribute an entry to the global resource. If we want to test some<br>
characteristics when include_directories[0] is A, and other characteristics<br>
when include_directories[0] is B, we have to use another test file.<br>
<br>
The arguments apply to many other types of tests (opt on .ll, llc on .ll and .mir, clang on .c, yaml2obj on .yaml, etc).<br>
<br>
I have a patch teaching llvm-mc about an option to split input: <a href="https://reviews.llvm.org/D83725" rel="noreferrer" target="_blank">https://reviews.llvm.org/D83725</a><br>
(30+ lines)<br>
<br>
In a comment, Richard Smith mentioned whether we can add a separate extractor utility:<br>
<br>
```<br>
# RUN: extract bb %s | llvm-mc - 2>&1 | FileCheck %s --check-prefix=BB<br>
<br>
or<br>
<br>
# RUN: extract bb %s -o %<a href="http://t.bb" rel="noreferrer" target="_blank">t.bb</a><br>
# RUN: llvm-mc %<a href="http://t.bb" rel="noreferrer" target="_blank">t.bb</a> 2>&1 | FileCheck %<a href="http://t.bb" rel="noreferrer" target="_blank">t.bb</a><br>
```<br></blockquote><div><br></div><div>Could make "extract" work a bit like "tee" so it can still be one line:<br><br># RUN: extract bb %s -o %<a href="http://t.bb">t.bb</a> | llvm-mc - 2>&1 | FileCheck %<a href="http://t.bb">t.bb</a><br><br>(could even make it a bit shorter for convenience - 'ex' or something)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The advantage is its versatility. The downside is somewhat verbose syntax.<br>
<br>
<br>
Some questoms:<br>
<br>
1. What do people think of the two approaches? An in-utility option vs a standalone utility.<br>
2. For llvm-mc, if we go with an option, is there a better name than --doc-id? David Blaikie proposed --asm-id<br>
   (This is my personal preference, trading 30+ lines in a utility for simpler syntax)<br>
3. If we add a standalone utility, how shall we name it? (Note that llvm-extract exists, but people can probably distinguish 'extract' from llvm-extract<br></blockquote><div><br>I think some of the truly internal utilities are named without the llvm prefix - isn't stuff like "not" actually implemented as a local tool? hmm, guess not, maybe that's a built-in inside lit.<br>Only risk I can think of with the name is the auto-name expansion of lit replacing any token 'ex' with the full path to the tool, so you might have to be careful about not using that character sequence as a standalone argument on a RUN line - but that seems OK.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>