Add struct for info about single test runs, update in global setters
Instead of exit codes, we will use the global instance of this (shared with a parent process) to determine the result of forked test runs.
This commit is contained in:
parent
9d47f21f5a
commit
d4dc9eaa01
@ -308,6 +308,12 @@ struct DeepState_TestInfo {
|
||||
unsigned line_number;
|
||||
};
|
||||
|
||||
struct DeepState_TestRunInfo {
|
||||
struct DeepState_TestInfo *test;
|
||||
enum DeepState_TestRunResult result;
|
||||
const char *reason;
|
||||
};
|
||||
|
||||
/* Pointer to the last registered `TestInfo` structure. */
|
||||
extern struct DeepState_TestInfo *DeepState_LastTestInfo;
|
||||
|
||||
|
||||
@ -48,22 +48,41 @@ jmp_buf DeepState_ReturnToRun = {};
|
||||
|
||||
static const char *DeepState_TestAbandoned = NULL;
|
||||
static int DeepState_TestFailed = 0;
|
||||
static struct DeepState_TestRunInfo *DeepState_CurrentTestRun = NULL;
|
||||
|
||||
static void DeepState_SetTestPassed(void) {
|
||||
DeepState_TestFailed = 0;
|
||||
|
||||
if (DeepState_CurrentTestRun) {
|
||||
DeepState_CurrentTestRun->result = DeepState_TestRunPass;
|
||||
}
|
||||
}
|
||||
|
||||
static void DeepState_SetTestFailed(void) {
|
||||
DeepState_TestFailed = 1;
|
||||
|
||||
if (DeepState_CurrentTestRun) {
|
||||
DeepState_CurrentTestRun->result = DeepState_TestRunFail;
|
||||
}
|
||||
}
|
||||
|
||||
static void DeepState_SetTestAbandoned(const char *reason) {
|
||||
DeepState_TestAbandoned = reason;
|
||||
|
||||
if (DeepState_CurrentTestRun) {
|
||||
DeepState_CurrentTestRun->result = DeepState_TestRunAbandon;
|
||||
DeepState_CurrentTestRun->reason = reason;
|
||||
}
|
||||
}
|
||||
|
||||
static void DeepState_InitTestGlobals(void) {
|
||||
DeepState_TestFailed = 0;
|
||||
DeepState_TestAbandoned = NULL;
|
||||
|
||||
if (DeepState_CurrentTestRun) {
|
||||
DeepState_CurrentTestRun->result = DeepState_TestRunPass;
|
||||
DeepState_CurrentTestRun->reason = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Abandon this test. We've hit some kind of internal problem. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user