summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka/test_sysdb_views.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_sysdb_views.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_sysdb_views.c')
-rw-r--r--src/tests/cmocka/test_sysdb_views.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/tests/cmocka/test_sysdb_views.c b/src/tests/cmocka/test_sysdb_views.c
index f5a5377ef..69118cd87 100644
--- a/src/tests/cmocka/test_sysdb_views.c
+++ b/src/tests/cmocka/test_sysdb_views.c
@@ -116,7 +116,7 @@ static int _setup_sysdb_tests(struct sysdb_test_ctx **ctx, bool enumerate)
#define setup_sysdb_tests(ctx) _setup_sysdb_tests((ctx), false)
-static void test_sysdb_setup(void **state)
+static int test_sysdb_setup(void **state)
{
int ret;
struct sysdb_test_ctx *test_ctx;
@@ -127,15 +127,17 @@ static void test_sysdb_setup(void **state)
assert_int_equal(ret, EOK);
*state = (void *) test_ctx;
+ return 0;
}
-static void test_sysdb_teardown(void **state)
+static int test_sysdb_teardown(void **state)
{
struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state,
struct sysdb_test_ctx);
talloc_free(test_ctx);
assert_true(leak_check_teardown());
+ return 0;
}
static void test_sysdb_store_override(void **state)
@@ -440,17 +442,17 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
- const UnitTest tests[] = {
- unit_test_setup_teardown(test_sysdb_store_override,
- test_sysdb_setup, test_sysdb_teardown),
- unit_test_setup_teardown(test_sysdb_add_overrides_to_object,
- test_sysdb_setup, test_sysdb_teardown),
- unit_test_setup_teardown(test_split_ipa_anchor,
- test_sysdb_setup, test_sysdb_teardown),
- unit_test_setup_teardown(test_sysdb_delete_view_tree,
- test_sysdb_setup, test_sysdb_teardown),
- unit_test_setup_teardown(test_sysdb_invalidate_overrides,
- test_sysdb_setup, test_sysdb_teardown),
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test_setup_teardown(test_sysdb_store_override,
+ test_sysdb_setup, test_sysdb_teardown),
+ cmocka_unit_test_setup_teardown(test_sysdb_add_overrides_to_object,
+ test_sysdb_setup, test_sysdb_teardown),
+ cmocka_unit_test_setup_teardown(test_split_ipa_anchor,
+ test_sysdb_setup, test_sysdb_teardown),
+ cmocka_unit_test_setup_teardown(test_sysdb_delete_view_tree,
+ test_sysdb_setup, test_sysdb_teardown),
+ cmocka_unit_test_setup_teardown(test_sysdb_invalidate_overrides,
+ test_sysdb_setup, test_sysdb_teardown),
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
@@ -473,7 +475,7 @@ int main(int argc, const char *argv[])
tests_set_cwd();
test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_FILE, LOCAL_SYSDB_FILE);
test_dom_suite_setup(TESTS_PATH);
- rv = run_tests(tests);
+ rv = cmocka_run_group_tests(tests, NULL, NULL);
if (rv == 0 && no_cleanup == 0) {
test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_FILE, LOCAL_SYSDB_FILE);