diff options
Diffstat (limited to 'zephyr/test/krabby/src/main.c')
-rw-r--r-- | zephyr/test/krabby/src/main.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/zephyr/test/krabby/src/main.c b/zephyr/test/krabby/src/main.c new file mode 100644 index 0000000000..2df530be93 --- /dev/null +++ b/zephyr/test/krabby/src/main.c @@ -0,0 +1,35 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "ec_app_main.h" +#include "test_state.h" + +#include <zephyr/kernel.h> +#include <zephyr/ztest.h> + +bool krabby_predicate_post_main(const void *state) +{ + return ((struct test_state *)state)->ec_app_main_run; +} + +void test_main(void) +{ + struct test_state state = { + .ec_app_main_run = false, + }; + + /* Run all the suites that depend on main not being called yet */ + ztest_run_test_suites(&state); + + ec_app_main(); + + state.ec_app_main_run = true; + + /* Run all the suites that depend on main being called */ + ztest_run_test_suites(&state); + + /* Check that every suite ran */ + ztest_verify_all_test_suites_ran(); +} |