[llvm-reduce] Fix a bug, improve error handling when running test
llvm::sys::ExecuteAndWait can report errors, so let's make use of that.
Second, while iterating uses of functions to remove, a call can appear
multiple times. Use a SetVector so we don't attempt to erase such a call
twice.
llvm-svn: 371653
diff --git a/llvm/tools/llvm-reduce/TestRunner.cpp b/llvm/tools/llvm-reduce/TestRunner.cpp
index 2fd01ab..1940e42 100644
--- a/llvm/tools/llvm-reduce/TestRunner.cpp
+++ b/llvm/tools/llvm-reduce/TestRunner.cpp
@@ -44,10 +44,14 @@
ProgramArgs.push_back(Arg.c_str());
Optional<StringRef> Redirects[3]; // STDIN, STDOUT, STDERR
- int Result = sys::ExecuteAndWait(TestName, ProgramArgs, None, Redirects);
+ std::string ErrMsg;
+ int Result =
+ sys::ExecuteAndWait(TestName, ProgramArgs, None, Redirects,
+ /*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg);
if (Result < 0) {
- Error E = make_error<StringError>("Error running interesting-ness test\n",
+ Error E = make_error<StringError>("Error running interesting-ness test: " +
+ ErrMsg,
inconvertibleErrorCode());
errs() << toString(std::move(E));
exit(1);