summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka/test_ifp.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-03-09 21:48:11 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-03-11 14:39:35 +0100
commit4e5e846de22407f825fe3b4040d79606818a2419 (patch)
tree99bf02588f00f39d29f0d2f9e3a439b65fd5d6c3 /src/tests/cmocka/test_ifp.c
parent0aad066baeed6833cf061b71d72c6bbbb2d2b9e8 (diff)
downloadsssd-4e5e846de22407f825fe3b4040d79606818a2419.tar.gz
sssd-4e5e846de22407f825fe3b4040d79606818a2419.tar.xz
sssd-4e5e846de22407f825fe3b4040d79606818a2419.zip
tests: convert all unit tests to cmocka 1.0 or later
All tests now use the cmocka-1.0-compatible API. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/tests/cmocka/test_ifp.c')
-rw-r--r--src/tests/cmocka/test_ifp.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/tests/cmocka/test_ifp.c b/src/tests/cmocka/test_ifp.c
index 484ab8568..a0fb5883c 100644
--- a/src/tests/cmocka/test_ifp.c
+++ b/src/tests/cmocka/test_ifp.c
@@ -360,7 +360,7 @@ struct ifp_test_req_ctx {
struct ifp_ctx *ifp_ctx;
};
-void ifp_test_req_setup(void **state)
+static int ifp_test_req_setup(void **state)
{
struct ifp_test_req_ctx *test_ctx;
errno_t ret;
@@ -381,9 +381,10 @@ void ifp_test_req_setup(void **state)
check_leaks_push(test_ctx);
*state = test_ctx;
+ return 0;
}
-void ifp_test_req_teardown(void **state)
+static int ifp_test_req_teardown(void **state)
{
struct ifp_test_req_ctx *test_ctx = talloc_get_type_abort(*state,
struct ifp_test_req_ctx);
@@ -394,6 +395,7 @@ void ifp_test_req_teardown(void **state)
talloc_free(test_ctx);
assert_true(leak_check_teardown());
+ return 0;
}
int main(int argc, const char *argv[])
@@ -406,14 +408,15 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
- const UnitTest tests[] = {
- unit_test(ifp_test_req_create),
- unit_test(ifp_test_req_wrong_uid),
- unit_test_setup_teardown(test_el_to_dict,
- ifp_test_req_setup, ifp_test_req_teardown),
- unit_test(test_attr_acl),
- unit_test(test_attr_acl_ex),
- unit_test(test_attr_allowed),
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(ifp_test_req_create),
+ cmocka_unit_test(ifp_test_req_wrong_uid),
+ cmocka_unit_test_setup_teardown(test_el_to_dict,
+ ifp_test_req_setup,
+ ifp_test_req_teardown),
+ cmocka_unit_test(test_attr_acl),
+ cmocka_unit_test(test_attr_acl_ex),
+ cmocka_unit_test(test_attr_allowed),
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
@@ -437,5 +440,5 @@ int main(int argc, const char *argv[])
* they might not after a failed run. Remove the old db to be sure */
tests_set_cwd();
- return run_tests(tests);
+ return cmocka_run_group_tests(tests, NULL, NULL);
}