[PATCH] D20716: FileCheck: dump command line context with empty input

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 12:22:18 PDT 2016


This is a good idea -- except that there seems to be no good way to
implement that.

For each test, tit tester first creates a shell script that executes
subtests as
 ...{ .... | FileCheck ..; } && { .... | FIleCheck ... ; } && ...

when one sub test fails, the information about which one is lost.

I will go ahead with this change first. If there are good suggestions on
lit improvement, we can revisit it later.

thanks,

David

On Fri, May 27, 2016 at 11:09 AM, David Blaikie <dblaikie at gmail.com> wrote:

> Should we instead modify lit to indicate which command it stopped at? That
> would seem more general/to cover other cases as well?
>
> On Thu, May 26, 2016 at 6:05 PM, David Li via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> davidxl created this revision.
>> davidxl added a reviewer: dblaikie.
>> davidxl added a subscriber: llvm-commits.
>>
>> 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).
>>
>> This patch enables FileCheck to dump the full command line as a context
>> line so that it is easier to identify the problem.
>>
>> http://reviews.llvm.org/D20716
>>
>> Files:
>>   test/FileCheck/check-empty.txt
>>   utils/FileCheck/FileCheck.cpp
>>
>> Index: utils/FileCheck/FileCheck.cpp
>> ===================================================================
>> --- utils/FileCheck/FileCheck.cpp
>> +++ utils/FileCheck/FileCheck.cpp
>> @@ -1298,6 +1298,13 @@
>>      CheckPrefixes.push_back("CHECK");
>>  }
>>
>> +static void DumpCommandLine(int argc, char **argv) {
>> +  errs() << "FileCheck command line: ";
>> +  for (int I = 0; I < argc; I++)
>> +    errs() << " " << argv[I];
>> +  errs() << "\n";
>> +}
>> +
>>  int main(int argc, char **argv) {
>>    sys::PrintStackTraceOnErrorSignal();
>>    PrettyStackTraceProgram X(argc, argv);
>> @@ -1331,6 +1338,7 @@
>>
>>    if (File->getBufferSize() == 0 && !AllowEmptyInput) {
>>      errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
>> +    DumpCommandLine(argc, argv);
>>      return 2;
>>    }
>>
>> Index: test/FileCheck/check-empty.txt
>> ===================================================================
>> --- test/FileCheck/check-empty.txt
>> +++ test/FileCheck/check-empty.txt
>> @@ -7,5 +7,6 @@
>>  ; NOFOO-NOT: foo
>>
>>  ; EMPTY-ERR: FileCheck error: '-' is empty.
>> +; EMPTY-ERR-NEXT: FileCheck command line: {{.*}}FileCheck
>> -check-prefix={{.*}}FOO {{.*}}check-empty.txt
>>  ; NO-EMPTY-ERR-NOT: FileCheck error: '-' is empty.
>>  ; NOT-FOUND: error: expected string not found in input
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160527/6d76f1dd/attachment.html>


More information about the llvm-commits mailing list