From 1c95079e94d71d8d271fd87cb8e1334d6fded2d9 Mon Sep 17 00:00:00 2001 From: Frances Wingerter Date: Mon, 22 Jul 2024 22:37:46 -0400 Subject: [PATCH] spoofed_criterion: support init functions --- misc/spoofed_criterion/include/criterion/criterion.h | 1 + misc/spoofed_criterion/test_runner.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/misc/spoofed_criterion/include/criterion/criterion.h b/misc/spoofed_criterion/include/criterion/criterion.h index df909e2ad..935f09676 100644 --- a/misc/spoofed_criterion/include/criterion/criterion.h +++ b/misc/spoofed_criterion/include/criterion/criterion.h @@ -3,6 +3,7 @@ struct fake_criterion_test { void (*test)(void); + void (*init)(void); int exit_code; }; diff --git a/misc/spoofed_criterion/test_runner.c b/misc/spoofed_criterion/test_runner.c index c1a18dfa6..fcad7c365 100644 --- a/misc/spoofed_criterion/test_runner.c +++ b/misc/spoofed_criterion/test_runner.c @@ -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; }