[llvm-dev] Swallowing of input in FileCheck
George Karpenkov via llvm-dev
llvm-dev at lists.llvm.org
Fri Jul 7 13:20:20 PDT 2017
Hi,
Debugging tests which make use of FileCheck can be a frustrating experience, as all input will be swallowed (even with -v flag passed to lit),
and one would often need to copy-and-paste and rerun the failing command manually without piping into FileCheck.
Initially I’ve assumed that this is done due to stream processing, but looking at FileCheck source code I can see that
it actually gets the entire input into RAM anyway:
```
do {
Buffer.reserve(Buffer.size() + ChunkSize);
ReadBytes = read(FD, Buffer.end(), ChunkSize);
if (ReadBytes == -1) {
if (errno == EINTR) continue;
return std::error_code(errno, std::generic_category());
}
Buffer.set_size(Buffer.size() + ReadBytes);
} while (ReadBytes != 0);
```
Thus, I propose modifying FileCheck default behavior to dump all swallowed output on stderr when the test has failed.
Would there be any objections to such a change?
I understand the concern that log files might become unnecessarily large, but since it would only be done for failed
test I think the added readability would be worth it.
Regards,
George
More information about the llvm-dev
mailing list