Skip to content

Commit facf8b7

Browse files
committed
Filecheck: Allow empty stderr input; replace last couple errs() uses (#3588)
1 parent fc2da73 commit facf8b7

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

tools/clang/unittests/HLSLTestLib/FileCheckForTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,14 +1333,14 @@ int run_main() {
13331333
MemoryBuffer::getMemBuffer(MemoryBufferRef(StringRef(InputForStdin), "-")) :
13341334
MemoryBuffer::getFile(InputFilename);
13351335
if (std::error_code EC = FileOrErr.getError()) {
1336-
errs() << "Could not open input file '" << InputFilename
1336+
test_errs << "Could not open input file '" << InputFilename
13371337
<< "': " << EC.message() << '\n';
13381338
return 2;
13391339
}
13401340
std::unique_ptr<MemoryBuffer> &File = FileOrErr.get();
13411341

13421342
if (File->getBufferSize() == 0 && !AllowEmptyInput) {
1343-
errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
1343+
test_errs << "FileCheck error: '" << InputFilename << "' is empty.\n";
13441344
return 2;
13451345
}
13461346

tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ FileRunCommandResult FileRunCommandPart::RunFileChecker(const FileRunCommandResu
139139
auto args = strtok(Arguments);
140140
for (const std::string& arg : args) {
141141
if (arg == "%s") hasInputFilename = true;
142-
else if (arg == "-input=stderr") t.InputForStdin = Prior->StdErr;
143-
else if (strstartswith(arg, checkPrefixStr))
142+
else if (arg == "-input=stderr") {
143+
t.InputForStdin = Prior->StdErr;
144+
t.AllowEmptyInput = true;
145+
} else if (strstartswith(arg, checkPrefixStr))
144146
t.CheckPrefixes.emplace_back(arg.substr(sizeof(checkPrefixStr) - 1));
145147
else if (strstartswith(arg, checkPrefixesStr)) {
146148
auto prefixes = strtok(arg.substr(sizeof(checkPrefixesStr) - 1), ", ");

0 commit comments

Comments
 (0)