mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Add a --crash option to not.
Now the two possible uses of not are * not cmd Will return true if cmd doesn't crash and returns false. * not --crash cmd Will return true if cmd crashes. It will be used/tested in a followup commit for the clang crash recovery testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185678 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,14 +13,33 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
int main(int argc, const char **argv) {
|
int main(int argc, const char **argv) {
|
||||||
std::string Program = sys::FindProgramByName(argv[1]);
|
bool ExpectCrash = false;
|
||||||
|
|
||||||
|
++argv;
|
||||||
|
--argc;
|
||||||
|
|
||||||
|
if (argc > 0 && StringRef(argv[0]) == "--crash") {
|
||||||
|
++argv;
|
||||||
|
--argc;
|
||||||
|
ExpectCrash = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
std::string Program = sys::FindProgramByName(argv[0]);
|
||||||
|
|
||||||
std::string ErrMsg;
|
std::string ErrMsg;
|
||||||
int Result = sys::ExecuteAndWait(Program, argv + 1, 0, 0, 0, 0, &ErrMsg);
|
int Result = sys::ExecuteAndWait(Program, argv, 0, 0, 0, 0, &ErrMsg);
|
||||||
if (Result < 0) {
|
if (Result < 0) {
|
||||||
errs() << "Error: " << ErrMsg << "\n";
|
errs() << "Error: " << ErrMsg << "\n";
|
||||||
|
if (ExpectCrash)
|
||||||
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ExpectCrash)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return Result == 0;
|
return Result == 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user