summaryrefslogtreecommitdiffstats
path: root/llvm/utils/FileCheck
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-08-07 18:40:37 +0000
committerJustin Bogner <mail@justinbogner.com>2014-08-07 18:40:37 +0000
commit1b9f936f91d9fe8700e47cea3347b2607fc5b506 (patch)
treeae4bb3a513ef001b8ab7ffae9b00b9a2a3be8ad5 /llvm/utils/FileCheck
parentf74c74693c6ee3eb7abf0d6f6b115e5f94fd6a39 (diff)
downloadbcm5719-llvm-1b9f936f91d9fe8700e47cea3347b2607fc5b506.tar.gz
bcm5719-llvm-1b9f936f91d9fe8700e47cea3347b2607fc5b506.zip
FileCheck: Add a flag to allow checking empty input
Currently FileCheck errors out on empty input. This is usually the right thing to do, but makes testing things like "this command does not emit some error message" hard to test. This usually leads to people using "command 2>&1 | count 0" instead, and then the bots that use guard malloc fail a few hours later. By adding a flag to FileCheck that allows empty inputs, we can make tests that consist entirely of "CHECK-NOT" lines feasible. llvm-svn: 215127
Diffstat (limited to 'llvm/utils/FileCheck')
-rw-r--r--llvm/utils/FileCheck/FileCheck.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index 8c62ae7f5d1..e8365fc248a 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -57,6 +57,11 @@ static cl::list<std::string> ImplicitCheckNot(
"this pattern occur which are not matched by a positive pattern"),
cl::value_desc("pattern"));
+static cl::opt<bool> AllowEmptyInput(
+ "allow-empty", cl::init(false),
+ cl::desc("Allow the input file to be empty. This is useful when making\n"
+ "checks that some error message does not occur, for example."));
+
typedef cl::list<std::string>::const_iterator prefix_iterator;
//===----------------------------------------------------------------------===//
@@ -1260,7 +1265,7 @@ int main(int argc, char **argv) {
}
std::unique_ptr<MemoryBuffer> &File = FileOrErr.get();
- if (File->getBufferSize() == 0) {
+ if (File->getBufferSize() == 0 && !AllowEmptyInput) {
errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
return 2;
}
OpenPOWER on IntegriCloud