From 989b06c20488af52c8c1d1a294a170a01817b157 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Tue, 21 Feb 2023 13:23:59 +0100 Subject: test: add ignore_ret for checking test result --- tests/unit/test_actions.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/unit/test_actions.c b/tests/unit/test_actions.c index 9e1480f..df31809 100644 --- a/tests/unit/test_actions.c +++ b/tests/unit/test_actions.c @@ -124,14 +124,16 @@ int get_fd_notifier(pid_t pid) return notifier; } -static void check_target_result(long ret, int err) +static void check_target_result(long ret, int err, bool ignore_ret) { int buf; read(pipefd[0], &buf, 1); - ck_assert_msg(at->ret == ret, - "expect return value %ld to be equal to %ld", at->ret, - ret); + if (!ignore_ret) + ck_assert_msg(at->ret == ret, + "expect return value %ld to be equal to %ld", + at->ret, + ret); ck_assert_int_eq(at->err, err); ck_assert_int_eq(close(pipefd[0]), 0); } @@ -227,7 +229,7 @@ START_TEST(test_act_block) int ret = do_actions(NULL, actions, sizeof(actions) / sizeof(actions[0]), -1, notifyfd, req.id); ck_assert_msg(ret == 0, strerror(errno)); - check_target_result(-1, 0); + check_target_result(-1, 0, false); } END_TEST @@ -242,7 +244,7 @@ START_TEST(test_act_return) int ret = do_actions(NULL, actions, sizeof(actions) / sizeof(actions[0]), -1, notifyfd, req.id); ck_assert_msg(ret == 0, strerror(errno)); - check_target_result(1, 0); + check_target_result(1, 0, false); } END_TEST @@ -258,7 +260,7 @@ START_TEST(test_act_return_ref) int ret = do_actions(NULL, actions, sizeof(actions) / sizeof(actions[0]), -1, notifyfd, req.id); ck_assert_msg(ret == 0, strerror(errno)); - check_target_result(v, 0); + check_target_result(v, 0, false); } END_TEST -- cgit v1.2.3