Skip to content

Commit

Permalink
spoofed_criterion: support init functions
Browse files Browse the repository at this point in the history
  • Loading branch information
fw-immunant committed Jul 24, 2024
1 parent 50d4fdf commit 97a8651
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions misc/spoofed_criterion/include/criterion/criterion.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

struct fake_criterion_test {
void (*test)(void);
void (*init)(void);
int exit_code;
};

Expand Down
3 changes: 3 additions & 0 deletions misc/spoofed_criterion/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ int main() {
pid_t pid = fork();
bool in_child = pid == 0;
if (in_child) {
if (test_info->init) {
(*test_info->init)();
}
(*test_info->test)();
return 0;
}
Expand Down

0 comments on commit 97a8651

Please sign in to comment.