diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/common/event.c | 22 | ||||
-rw-r--r-- | test/py/tests/test_event_dump.py | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/test/common/event.c b/test/common/event.c index 6037ae2ce3..c0912a3437 100644 --- a/test/common/event.c +++ b/test/common/event.c @@ -18,6 +18,8 @@ struct test_state { int val; }; +static bool called; + static int h_adder(void *ctx, struct event *event) { struct event_data_test *data = &event->data.test; @@ -28,6 +30,14 @@ static int h_adder(void *ctx, struct event *event) return 0; } +static int h_adder_simple(void) +{ + called = true; + + return 0; +} +EVENT_SPY_SIMPLE(EVT_TEST, h_adder_simple); + static int test_event_base(struct unit_test_state *uts) { struct test_state state; @@ -46,6 +56,18 @@ static int test_event_base(struct unit_test_state *uts) } COMMON_TEST(test_event_base, 0); +static int test_event_simple(struct unit_test_state *uts) +{ + called = false; + + /* Check that the handler is called */ + ut_assertok(event_notify_null(EVT_TEST)); + ut_assert(called); + + return 0; +} +COMMON_TEST(test_event_simple, 0); + static int h_probe(void *ctx, struct event *event) { struct test_state *test_state = ctx; diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py index da196df4c3..041f8f9c97 100644 --- a/test/py/tests/test_event_dump.py +++ b/test/py/tests/test_event_dump.py @@ -18,5 +18,6 @@ def test_event_dump(u_boot_console): -------------------- ------------------------------ ------------------------------ EVT_FT_FIXUP bootmeth_vbe_ft_fixup .*boot/vbe_request.c:.* EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*boot/vbe_simple_os.c:.* -EVT_MISC_INIT_F sandbox_misc_init_f .*arch/sandbox/cpu/start.c:''' +EVT_MISC_INIT_F sandbox_misc_init_f .*arch/sandbox/cpu/start.c:.* +EVT_TEST h_adder_simple .*test/common/event.c:''' assert re.match(expect, out, re.MULTILINE) is not None |