Add DeepState_TakeOver() interface

This commit is contained in:
Joe Ranweiler
2018-02-19 11:45:57 -08:00
parent 0a746ca078
commit 45fcfe0921
2 changed files with 15 additions and 0 deletions

View File

@@ -309,6 +309,8 @@ struct DeepState_TestInfo {
/* Pointer to the last registered `TestInfo` structure. */
extern struct DeepState_TestInfo *DeepState_LastTestInfo;
extern int DeepState_TakeOver(void);
/* Defines the entrypoint of a test case. This creates a data structure that
* contains the information about the test, and then creates an initializer
* function that runs before `main` that registers the test entrypoint with

View File

@@ -364,6 +364,19 @@ void DrMemFuzzFunc(volatile uint8_t *buff, size_t size) {
}
}
int DeepState_TakeOver(void) {
struct DeepState_TestInfo test = {
.prev = NULL,
.test_func = NULL,
.test_name = "<__TAKE_OVER_TEST>",
.file_name = "<__TAKE_OVER_FILE>",
.line_number = 0,
};
DeepState_Begin(&test);
return 0;
}
/* Notify that we're about to begin a test while running under Dr. Fuzz. */
void DeepState_BeginDrFuzz(struct DeepState_TestInfo *test) {
DeepState_DrFuzzTest = test;