[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:46:17 PDT 2016


On Fri, May 27, 2016 at 12:40 PM, Matthias Braun <mbraun at apple.com> wrote:

> I'd love to see lit report which of the commands failed! I sometimes
> change lit locally:
>
> -            f.write('set -o pipefail;')
> +            f.write('set -o pipefail -x;')
>
> as a bad hack to get this information. We could certainly run the tests
> one by one instead of concatenating them (in fact lit on windows does that
> and does report which one failed AFAIK). I did not make this change on unix
> because I feared it would slow down testing...
>
>
Ok -- looks like this is a common pain.  In many cases, user can get away
with it as the the stderr and stdout output can give out some clues --
except for this case we are left with some message that is almost useless.



> In anyway the FileCheck modification you proposed should improve the
> situation a bit. LGTM.
>

thanks,

David


>
> - Matthias
>
> On May 27, 2016, at 12:22 PM, Xinliang David Li via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> 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
>>>
>>>
>>
> _______________________________________________
> 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/0bd96d08/attachment.html>


More information about the llvm-commits mailing list