Update the cyclic test code to verify return code from cyclic_register() works.
Signed-off-by: Marek Vasut <[email protected]> --- Cc: Aaron Williams <[email protected]> Cc: Anatolij Gustschin <[email protected]> Cc: Angelo Dureghello <[email protected]> Cc: Christian Marangi <[email protected]> Cc: Devarsh Thakkar <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Jaehoon Chung <[email protected]> Cc: Michael Polyntsov <[email protected]> Cc: Michael Trimarchi <[email protected]> Cc: Nikhil M Jain <[email protected]> Cc: Peng Fan <[email protected]> Cc: Peter Robinson <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Ronald Wahl <[email protected]> Cc: Simon Glass <[email protected]> Cc: Stefan Roese <[email protected]> Cc: Tim Harvey <[email protected]> Cc: Tom Rini <[email protected]> Cc: [email protected] --- test/common/cyclic.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/common/cyclic.c b/test/common/cyclic.c index 51a07c576b6..714dec60b7f 100644 --- a/test/common/cyclic.c +++ b/test/common/cyclic.c @@ -25,8 +25,11 @@ static void test_cb(struct cyclic_info *c) static int dm_test_cyclic_running(struct unit_test_state *uts) { + int ret; + cyclic_test.called = false; - cyclic_register(&cyclic_test.cyclic, test_cb, 10 * 1000, "cyclic_test"); + ret = cyclic_register(&cyclic_test.cyclic, test_cb, 10 * 1000, "cyclic_test"); + ut_asserteq(ret, 0); /* Execute all registered cyclic functions */ schedule(); @@ -37,3 +40,19 @@ static int dm_test_cyclic_running(struct unit_test_state *uts) return 0; } COMMON_TEST(dm_test_cyclic_running, 0); + +static int dm_test_cyclic_reregister(struct unit_test_state *uts) +{ + int ret; + + cyclic_test.called = false; + ret = cyclic_register(&cyclic_test.cyclic, test_cb, 10 * 1000, "cyclic_test1"); + ut_asserteq(ret, 0); + ret = cyclic_register(&cyclic_test.cyclic, test_cb, 10 * 1000, "cyclic_test2"); + ut_asserteq(ret, -EALREADY); + + cyclic_unregister(&cyclic_test.cyclic); + + return 0; +} +COMMON_TEST(dm_test_cyclic_reregister, 0); -- 2.45.2

