Add DeepState_Crash() hook

This commit is contained in:
Joe Ranweiler
2018-02-14 12:03:45 -08:00
parent 8ede1e2ddc
commit 23af5b562d
2 changed files with 10 additions and 0 deletions

View File

@@ -184,6 +184,9 @@ extern void _DeepState_Assume(int expr, const char *expr_str, const char *file,
DEEPSTATE_NORETURN
extern void DeepState_Abandon(const char *reason);
/* Mark this test as having crashed. */
extern void DeepState_Crash(void);
DEEPSTATE_NORETURN
extern void DeepState_Fail(void);
@@ -473,6 +476,7 @@ static int DeepState_ForkAndRunTest(struct DeepState_TestInfo *test) {
}
/* If here, we exited abnormally, and so the test failed due to a crash. */
DeepState_Crash();
DeepState_LogFormat(DeepState_LogError, "Crashed: %s", test->test_name);
if (HAS_FLAG_output_test_dir) {

View File

@@ -55,6 +55,11 @@ void DeepState_Abandon(const char *reason) {
longjmp(DeepState_ReturnToRun, 1);
}
/* Mark this test as having crashed. */
void DeepState_Crash(void) {
DeepState_TestFailed = 1;
}
/* Mark this test as failing. */
DEEPSTATE_NORETURN
void DeepState_Fail(void) {
@@ -261,6 +266,7 @@ const struct DeepState_IndexEntry DeepState_API[] = {
/* Control-flow during the test. */
{"Pass", (void *) DeepState_Pass},
{"Crash", (void *) DeepState_Crash},
{"Fail", (void *) DeepState_Fail},
{"SoftFail", (void *) DeepState_SoftFail},
{"Abandon", (void *) DeepState_Abandon},