aboutgitcodelistschat:MatrixIRC
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-02-21 13:23:59 +0100
committerAlice Frosi <afrosi@redhat.com>2023-02-21 13:28:09 +0100
commit989b06c20488af52c8c1d1a294a170a01817b157 (patch)
treeec1b169544e120c1c2f6f24abeb9e65ab43e30d0
parentbe0b13f553126297d7e15c2b969e5d1debe34894 (diff)
downloadseitan-989b06c20488af52c8c1d1a294a170a01817b157.tar
seitan-989b06c20488af52c8c1d1a294a170a01817b157.tar.gz
seitan-989b06c20488af52c8c1d1a294a170a01817b157.tar.bz2
seitan-989b06c20488af52c8c1d1a294a170a01817b157.tar.lz
seitan-989b06c20488af52c8c1d1a294a170a01817b157.tar.xz
seitan-989b06c20488af52c8c1d1a294a170a01817b157.tar.zst
seitan-989b06c20488af52c8c1d1a294a170a01817b157.zip
test: add ignore_ret for checking test result
-rw-r--r--tests/unit/test_actions.c16
1 files 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