From 49e031fcb87ffed118725cb91d6251d166bf8f47 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Tue, 21 Feb 2023 13:27:23 +0100 Subject: test: add test for act_call --- tests/unit/test_actions.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_actions.c b/tests/unit/test_actions.c index df31809..4916200 100644 --- a/tests/unit/test_actions.c +++ b/tests/unit/test_actions.c @@ -278,6 +278,22 @@ START_TEST(test_act_return_empty_ref) } END_TEST +START_TEST(test_act_call) +{ + struct action actions[] = { + { + .type = A_CALL, + .call = { .nr = __NR_getppid, .has_ret = false }, + }, + { .type = A_CONT }, + }; + 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, true); +} +END_TEST + static void test_inject(struct action actions[], int n) { int fd_inj; @@ -312,7 +328,7 @@ Suite *action_call_suite(void) { Suite *s; int timeout = 30; - TCase *cont, *block, *ret; + TCase *cont, *block, *ret, *call; TCase *inject, *inject_a; s = suite_create("Perform actions"); @@ -337,6 +353,12 @@ Suite *action_call_suite(void) tcase_add_test(block, test_act_block); suite_add_tcase(s, block); + call = tcase_create("a_call"); + tcase_add_checked_fixture(call, setup_without_fd, teardown); + tcase_set_timeout(call, timeout); + tcase_add_test(call, test_act_call); + suite_add_tcase(s, call); + inject = tcase_create("a_inject"); tcase_add_checked_fixture(inject, setup_fd, teardown); tcase_set_timeout(inject, timeout); -- cgit v1.2.3