summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka/test_fo_srv.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_fo_srv.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_fo_srv.c')
-rw-r--r--src/tests/cmocka/test_fo_srv.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/tests/cmocka/test_fo_srv.c b/src/tests/cmocka/test_fo_srv.c
index 3ee308bd5..7a6321006 100644
--- a/src/tests/cmocka/test_fo_srv.c
+++ b/src/tests/cmocka/test_fo_srv.c
@@ -207,7 +207,7 @@ int test_fo_srv_data_cmp(void *ud1, void *ud2)
return strcasecmp((char*) ud1, (char*) ud2);
}
-void test_fo_srv_setup(void **state)
+static int test_fo_srv_setup(void **state)
{
struct test_fo_srv_ctx *test_ctx;
errno_t ret;
@@ -253,9 +253,10 @@ void test_fo_srv_setup(void **state)
assert_int_equal(ret, ERR_OK);
*state = test_ctx;
+ return 0;
}
-void test_fo_srv_teardown(void **state)
+static int test_fo_srv_teardown(void **state)
{
struct test_fo_srv_ctx *test_ctx =
talloc_get_type(*state, struct test_fo_srv_ctx);
@@ -263,6 +264,7 @@ void test_fo_srv_teardown(void **state)
talloc_free(test_ctx);
talloc_free(global_mock_context);
assert_true(leak_check_teardown());
+ return 0;
}
/* reply_list and dns_domain must be a talloc context so it can be used as
@@ -564,13 +566,13 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
- const UnitTest tests[] = {
- unit_test_setup_teardown(test_fo_srv,
- test_fo_srv_setup,
- test_fo_srv_teardown),
- unit_test_setup_teardown(test_fo_srv_ttl_change,
- test_fo_srv_setup,
- test_fo_srv_teardown),
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test_setup_teardown(test_fo_srv,
+ test_fo_srv_setup,
+ test_fo_srv_teardown),
+ cmocka_unit_test_setup_teardown(test_fo_srv_ttl_change,
+ test_fo_srv_setup,
+ test_fo_srv_teardown),
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
@@ -594,6 +596,6 @@ int main(int argc, const char *argv[])
* they might not after a failed run. Remove the old db to be sure */
tests_set_cwd();
- rv = run_tests(tests);
+ rv = cmocka_run_group_tests(tests, NULL, NULL);
return rv;
}