Merge pull request #175 from trailofbits/fix_eclipser
Fix Eclipser interface
This commit is contained in:
commit
052042ac0b
@ -49,7 +49,7 @@ def main():
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--verbose", type=int, help="Verbosity level.",
|
"--verbose", type=int, help="Verbosity level.",
|
||||||
default=1)
|
default=None)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--exectimeout", type=int, help="Execution timeout (ms) for Eclipser fuzz runs.",
|
"--exectimeout", type=int, help="Execution timeout (ms) for Eclipser fuzz runs.",
|
||||||
@ -100,9 +100,11 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
cmd = ["dotnet", eclipser, "fuzz"]
|
cmd = ["dotnet", eclipser, "fuzz"]
|
||||||
cmd += ["-p", deepstate, "-v", str(args.verbose)]
|
cmd += ["-p", deepstate]
|
||||||
|
if args.verbose is not None:
|
||||||
|
cmd += ["-v", str(args.verbose)]
|
||||||
cmd += ["-t", str(args.timeout), "-o", out + "/eclipser.run", "--src", "file"]
|
cmd += ["-t", str(args.timeout), "-o", out + "/eclipser.run", "--src", "file"]
|
||||||
deepargs = "--input_test_file eclipser.input --abort_on_fail"
|
deepargs = "--input_test_file eclipser.input --abort_on_fail --no_fork"
|
||||||
if whichTest is not None:
|
if whichTest is not None:
|
||||||
deepargs += " --input_which_test " + whichTest
|
deepargs += " --input_which_test " + whichTest
|
||||||
cmd += ["--initarg", deepargs]
|
cmd += ["--initarg", deepargs]
|
||||||
|
|||||||
@ -247,6 +247,12 @@ DEEPSTATE_INLINE static void DeepState_Assert(int expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used to make DeepState really crash for fuzzers, on any platform. */
|
||||||
|
DEEPSTATE_INLINE static void DeepState_HardCrash() {
|
||||||
|
char *p = 0;
|
||||||
|
(*p) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Asserts that `expr` must hold. If it does not, then the test fails, but
|
/* Asserts that `expr` must hold. If it does not, then the test fails, but
|
||||||
* nonetheless continues on. */
|
* nonetheless continues on. */
|
||||||
DEEPSTATE_INLINE static void DeepState_Check(int expr) {
|
DEEPSTATE_INLINE static void DeepState_Check(int expr) {
|
||||||
@ -578,6 +584,9 @@ static int DeepState_RunTestNoFork(struct DeepState_TestInfo *test) {
|
|||||||
if (HAS_FLAG_output_test_dir) {
|
if (HAS_FLAG_output_test_dir) {
|
||||||
DeepState_SaveFailingTest();
|
DeepState_SaveFailingTest();
|
||||||
}
|
}
|
||||||
|
if (HAS_FLAG_abort_on_fail) {
|
||||||
|
DeepState_HardCrash();
|
||||||
|
}
|
||||||
return(DeepState_TestRunFail);
|
return(DeepState_TestRunFail);
|
||||||
|
|
||||||
/* The test was abandoned. We may have gotten soft failures before
|
/* The test was abandoned. We may have gotten soft failures before
|
||||||
@ -753,7 +762,7 @@ static int DeepState_RunSingleSavedTestCase(void) {
|
|||||||
|
|
||||||
if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) {
|
if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) {
|
||||||
if (FLAGS_abort_on_fail) {
|
if (FLAGS_abort_on_fail) {
|
||||||
assert(0); // Terminate in a way AFL/etc. can see as a crash
|
DeepState_HardCrash();
|
||||||
}
|
}
|
||||||
if (FLAGS_exit_on_fail) {
|
if (FLAGS_exit_on_fail) {
|
||||||
exit(255); // Terminate the testing
|
exit(255); // Terminate the testing
|
||||||
@ -829,7 +838,7 @@ static int DeepState_RunSingleSavedTestDir(void) {
|
|||||||
|
|
||||||
if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) {
|
if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) {
|
||||||
if (FLAGS_abort_on_fail) {
|
if (FLAGS_abort_on_fail) {
|
||||||
assert(0); // Terminate in a way AFL/etc. can see as a crash
|
DeepState_HardCrash();
|
||||||
}
|
}
|
||||||
if (FLAGS_exit_on_fail) {
|
if (FLAGS_exit_on_fail) {
|
||||||
exit(255); // Terminate the testing
|
exit(255); // Terminate the testing
|
||||||
|
|||||||
@ -833,7 +833,7 @@ enum DeepState_TestRunResult DeepState_FuzzOneTestCase(struct DeepState_TestInfo
|
|||||||
|
|
||||||
if (FLAGS_abort_on_fail && ((result == DeepState_TestRunCrash) ||
|
if (FLAGS_abort_on_fail && ((result == DeepState_TestRunCrash) ||
|
||||||
(result == DeepState_TestRunFail))) {
|
(result == DeepState_TestRunFail))) {
|
||||||
assert(0); // Terminate the testing in a way AFL/etc. can see as a crash
|
DeepState_HardCrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FLAGS_exit_on_fail && ((result == DeepState_TestRunCrash) ||
|
if (FLAGS_exit_on_fail && ((result == DeepState_TestRunCrash) ||
|
||||||
@ -920,6 +920,9 @@ void __assert_fail(const char * assertion, const char * file,
|
|||||||
DeepState_LogFormat(DeepState_LogFatal,
|
DeepState_LogFormat(DeepState_LogFatal,
|
||||||
"%s(%u): Assertion %s failed in function %s",
|
"%s(%u): Assertion %s failed in function %s",
|
||||||
file, line, assertion, function);
|
file, line, assertion, function);
|
||||||
|
if (FLAGS_abort_on_fail) {
|
||||||
|
DeepState_HardCrash();
|
||||||
|
}
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user