blob: 319d42e3adc7987c26fdfd3fb3849c2e3e0e17b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <zephyr/zephyr.h>
#include <ztest.h>
#include "ec_app_main.h"
#include "test/drivers/test_state.h"
bool drivers_predicate_pre_main(const void *state)
{
return ((struct test_state *)state)->ec_app_main_run == false;
}
bool drivers_predicate_post_main(const void *state)
{
return !drivers_predicate_pre_main(state);
}
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();
}
|