<div dir="ltr">Should we instead modify lit to indicate which command it stopped at? That would seem more general/to cover other cases as well?</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 26, 2016 at 6:05 PM, David Li via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">davidxl created this revision.<br>
davidxl added a reviewer: dblaikie.<br>
davidxl added a subscriber: llvm-commits.<br>
<br>
FileCheck dumps minimal information when input is empty. We have many tests that include more than one FileCheck command lines. When such an error happens, figuring out which command actually is the problem can be hard sometimes (e.g, without running environment to reproduce).<br>
<br>
This patch enables FileCheck to dump the full command line as a context line so that it is easier to identify the problem.<br>
<br>
<a href="http://reviews.llvm.org/D20716" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20716</a><br>
<br>
Files:<br>
test/FileCheck/check-empty.txt<br>
utils/FileCheck/FileCheck.cpp<br>
<br>
Index: utils/FileCheck/FileCheck.cpp<br>
===================================================================<br>
--- utils/FileCheck/FileCheck.cpp<br>
+++ utils/FileCheck/FileCheck.cpp<br>
@@ -1298,6 +1298,13 @@<br>
CheckPrefixes.push_back("CHECK");<br>
}<br>
<br>
+static void DumpCommandLine(int argc, char **argv) {<br>
+ errs() << "FileCheck command line: ";<br>
+ for (int I = 0; I < argc; I++)<br>
+ errs() << " " << argv[I];<br>
+ errs() << "\n";<br>
+}<br>
+<br>
int main(int argc, char **argv) {<br>
sys::PrintStackTraceOnErrorSignal();<br>
PrettyStackTraceProgram X(argc, argv);<br>
@@ -1331,6 +1338,7 @@<br>
<br>
if (File->getBufferSize() == 0 && !AllowEmptyInput) {<br>
errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";<br>
+ DumpCommandLine(argc, argv);<br>
return 2;<br>
}<br>
<br>
Index: test/FileCheck/check-empty.txt<br>
===================================================================<br>
--- test/FileCheck/check-empty.txt<br>
+++ test/FileCheck/check-empty.txt<br>
@@ -7,5 +7,6 @@<br>
; NOFOO-NOT: foo<br>
<br>
; EMPTY-ERR: FileCheck error: '-' is empty.<br>
+; EMPTY-ERR-NEXT: FileCheck command line: {{.*}}FileCheck -check-prefix={{.*}}FOO {{.*}}check-empty.txt<br>
; NO-EMPTY-ERR-NOT: FileCheck error: '-' is empty.<br>
; NOT-FOUND: error: expected string not found in input<br>
<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>