Filecheck: Allow empty stderr input; replace last couple errs() uses (#3588)
This commit is contained in:
Родитель
eed1d039da
Коммит
92fa2508c4
|
@ -1333,14 +1333,14 @@ int run_main() {
|
|||
MemoryBuffer::getMemBuffer(MemoryBufferRef(StringRef(InputForStdin), "-")) :
|
||||
MemoryBuffer::getFile(InputFilename);
|
||||
if (std::error_code EC = FileOrErr.getError()) {
|
||||
errs() << "Could not open input file '" << InputFilename
|
||||
test_errs << "Could not open input file '" << InputFilename
|
||||
<< "': " << EC.message() << '\n';
|
||||
return 2;
|
||||
}
|
||||
std::unique_ptr<MemoryBuffer> &File = FileOrErr.get();
|
||||
|
||||
if (File->getBufferSize() == 0 && !AllowEmptyInput) {
|
||||
errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
|
||||
test_errs << "FileCheck error: '" << InputFilename << "' is empty.\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,8 +139,10 @@ FileRunCommandResult FileRunCommandPart::RunFileChecker(const FileRunCommandResu
|
|||
auto args = strtok(Arguments);
|
||||
for (const std::string& arg : args) {
|
||||
if (arg == "%s") hasInputFilename = true;
|
||||
else if (arg == "-input=stderr") t.InputForStdin = Prior->StdErr;
|
||||
else if (strstartswith(arg, checkPrefixStr))
|
||||
else if (arg == "-input=stderr") {
|
||||
t.InputForStdin = Prior->StdErr;
|
||||
t.AllowEmptyInput = true;
|
||||
} else if (strstartswith(arg, checkPrefixStr))
|
||||
t.CheckPrefixes.emplace_back(arg.substr(sizeof(checkPrefixStr) - 1));
|
||||
else if (strstartswith(arg, checkPrefixesStr)) {
|
||||
auto prefixes = strtok(arg.substr(sizeof(checkPrefixesStr) - 1), ", ");
|
||||
|
|
Загрузка…
Ссылка в новой задаче