diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-03-09 21:48:11 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-03-24 18:15:21 +0100 |
commit | 8d1ae1f350f5618f1d8f00211d6db6b025e52dd6 (patch) | |
tree | 7aa5411c9a4ff075f79a9a42b8eaf275f73f4875 /src/tests/cmocka/test_sdap.c | |
parent | cbab37e665d948278a491733e3993ac62beb0427 (diff) | |
download | sssd-8d1ae1f350f5618f1d8f00211d6db6b025e52dd6.tar.gz sssd-8d1ae1f350f5618f1d8f00211d6db6b025e52dd6.tar.xz sssd-8d1ae1f350f5618f1d8f00211d6db6b025e52dd6.zip |
tests: convert all unit tests to cmocka 1.0 or later
All tests now use the cmocka-1.0-compatible API.
Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/tests/cmocka/test_sdap.c')
-rw-r--r-- | src/tests/cmocka/test_sdap.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/src/tests/cmocka/test_sdap.c b/src/tests/cmocka/test_sdap.c index 404e100a8..a1c9aefd8 100644 --- a/src/tests/cmocka/test_sdap.c +++ b/src/tests/cmocka/test_sdap.c @@ -246,7 +246,7 @@ struct parse_test_ctx { struct sdap_msg sm; }; -void parse_entry_test_setup(void **state) +static int parse_entry_test_setup(void **state) { struct parse_test_ctx *test_ctx; @@ -257,9 +257,10 @@ void parse_entry_test_setup(void **state) check_leaks_push(test_ctx); *state = test_ctx; + return 0; } -void parse_entry_test_teardown(void **state) +static int parse_entry_test_teardown(void **state) { struct parse_test_ctx *test_ctx = talloc_get_type_abort(*state, struct parse_test_ctx); @@ -267,6 +268,7 @@ void parse_entry_test_teardown(void **state) assert_true(check_leaks_pop(test_ctx) == true); talloc_free(test_ctx); assert_true(leak_check_teardown()); + return 0; } void test_parse_with_map(void **state) @@ -728,41 +730,41 @@ int main(int argc, const char *argv[]) POPT_TABLEEND }; - const UnitTest tests[] = { - unit_test_setup_teardown(test_parse_with_map, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_no_map, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_no_attrs, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_dups, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_deref, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_deref_no_attrs, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_secondary_oc, - parse_entry_test_setup, - parse_entry_test_teardown), + const struct CMUnitTest tests[] = { + cmocka_unit_test_setup_teardown(test_parse_with_map, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_no_map, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_no_attrs, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_dups, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_deref, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_deref_no_attrs, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_secondary_oc, + parse_entry_test_setup, + parse_entry_test_teardown), /* Negative tests */ - unit_test_setup_teardown(test_parse_no_oc, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_bad_oc, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_no_dn, - parse_entry_test_setup, - parse_entry_test_teardown), - unit_test_setup_teardown(test_parse_deref_map_mismatch, - parse_entry_test_setup, - parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_no_oc, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_bad_oc, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_no_dn, + parse_entry_test_setup, + parse_entry_test_teardown), + cmocka_unit_test_setup_teardown(test_parse_deref_map_mismatch, + parse_entry_test_setup, + parse_entry_test_teardown), }; /* Set debug level to invalid value so we can deside if -d 0 was used. */ @@ -786,5 +788,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); } |