mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-04 22:11:41 +00:00
More hooks unit test
Checks we cannot call non-registered deferred functions. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I6cf67f85c7749632627819cc05e6809c040fb697 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58330 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
10
test/hooks.c
10
test/hooks.c
@@ -56,6 +56,11 @@ static void deferred_func(void)
|
||||
}
|
||||
DECLARE_DEFERRED(deferred_func);
|
||||
|
||||
static void non_deferred_func(void)
|
||||
{
|
||||
deferred_call_count++;
|
||||
}
|
||||
|
||||
static int test_init(void)
|
||||
{
|
||||
TEST_ASSERT(init_hook_count == 1);
|
||||
@@ -116,6 +121,11 @@ static int test_deferred(void)
|
||||
usleep(50 * MSEC);
|
||||
TEST_ASSERT(deferred_call_count == 2);
|
||||
|
||||
TEST_ASSERT(hook_call_deferred(non_deferred_func, 50 * MSEC) !=
|
||||
EC_SUCCESS);
|
||||
usleep(100 * MSEC);
|
||||
TEST_ASSERT(deferred_call_count == 2);
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user