mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
LibTest: Change Crash
forked process communication
Now it returns `Failure` value via `exit`, and the caller is responsible of reporting errors to the user.
This commit is contained in:
parent
c8cabd433a
commit
2f8fac3528
1 changed files with 5 additions and 3 deletions
|
@ -40,17 +40,19 @@ bool Crash::run(RunType run_type)
|
||||||
if (prctl(PR_SET_DUMPABLE, 0, 0) < 0)
|
if (prctl(PR_SET_DUMPABLE, 0, 0) < 0)
|
||||||
perror("prctl(PR_SET_DUMPABLE)");
|
perror("prctl(PR_SET_DUMPABLE)");
|
||||||
#endif
|
#endif
|
||||||
return do_report(m_crash_function());
|
exit((int)m_crash_function());
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
waitpid(pid, &status, 0);
|
waitpid(pid, &status, 0);
|
||||||
|
if (WIFEXITED(status)) {
|
||||||
|
return do_report(Failure(WEXITSTATUS(status)));
|
||||||
|
}
|
||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
outln("\x1B[32mPASS\x1B[0m: Terminated with signal {}", WTERMSIG(status));
|
outln("\x1B[32mPASS\x1B[0m: Terminated with signal {}", WTERMSIG(status));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue