diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-03-09 21:48:11 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-03-11 14:39:35 +0100 |
commit | 4e5e846de22407f825fe3b4040d79606818a2419 (patch) | |
tree | 99bf02588f00f39d29f0d2f9e3a439b65fd5d6c3 /src/tests/cwrap | |
parent | 0aad066baeed6833cf061b71d72c6bbbb2d2b9e8 (diff) | |
download | sssd-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/cwrap')
-rw-r--r-- | src/tests/cwrap/test_become_user.c | 8 | ||||
-rw-r--r-- | src/tests/cwrap/test_responder_common.c | 22 | ||||
-rw-r--r-- | src/tests/cwrap/test_server.c | 10 | ||||
-rw-r--r-- | src/tests/cwrap/test_usertools.c | 10 |
4 files changed, 26 insertions, 24 deletions
diff --git a/src/tests/cwrap/test_become_user.c b/src/tests/cwrap/test_become_user.c index 7ecea5aac..b9e8a5c3b 100644 --- a/src/tests/cwrap/test_become_user.c +++ b/src/tests/cwrap/test_become_user.c @@ -133,9 +133,9 @@ int main(int argc, const char *argv[]) POPT_TABLEEND }; - const UnitTest tests[] = { - unit_test(test_become_user), - unit_test(test_switch_user), + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_become_user), + cmocka_unit_test(test_switch_user), }; /* Set debug level to invalid value so we can deside if -d 0 was used. */ @@ -159,5 +159,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); } diff --git a/src/tests/cwrap/test_responder_common.c b/src/tests/cwrap/test_responder_common.c index 7e3f2e025..2c92ff080 100644 --- a/src/tests/cwrap/test_responder_common.c +++ b/src/tests/cwrap/test_responder_common.c @@ -111,7 +111,7 @@ struct create_pipe_ctx { const char *sock_name; }; -void test_create_pipe_fd_setup(void **state) +static int test_create_pipe_fd_setup(void **state) { struct create_pipe_ctx *ctx; @@ -120,6 +120,7 @@ void test_create_pipe_fd_setup(void **state) ctx->fd = -1; *state = ctx; + return 0; } void check_sock_properties(struct create_pipe_ctx *ctx, mode_t mode) @@ -181,7 +182,7 @@ void test_create_pipe_fd(void **state) check_sock_properties(ctx, 0777); } -void test_create_pipe_fd_teardown(void **state) +static int test_create_pipe_fd_teardown(void **state) { struct create_pipe_ctx *ctx; @@ -191,6 +192,7 @@ void test_create_pipe_fd_teardown(void **state) unlink(ctx->sock_name); close(ctx->fd); } + return 0; } int main(int argc, const char *argv[]) @@ -203,13 +205,13 @@ int main(int argc, const char *argv[]) POPT_TABLEEND }; - const UnitTest tests[] = { - unit_test(test_uid_csv_to_uid_list), - unit_test(test_name_csv_to_uid_list), - unit_test(test_csv_to_uid_list_neg), - unit_test_setup_teardown(test_create_pipe_fd, - test_create_pipe_fd_setup, - test_create_pipe_fd_teardown) + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_uid_csv_to_uid_list), + cmocka_unit_test(test_name_csv_to_uid_list), + cmocka_unit_test(test_csv_to_uid_list_neg), + cmocka_unit_test_setup_teardown(test_create_pipe_fd, + test_create_pipe_fd_setup, + test_create_pipe_fd_teardown) }; /* Set debug level to invalid value so we can deside if -d 0 was used. */ @@ -231,5 +233,5 @@ int main(int argc, const char *argv[]) tests_set_cwd(); - return run_tests(tests); + return cmocka_run_group_tests(tests, NULL, NULL); } diff --git a/src/tests/cwrap/test_server.c b/src/tests/cwrap/test_server.c index 55ef2ecae..799de26f5 100644 --- a/src/tests/cwrap/test_server.c +++ b/src/tests/cwrap/test_server.c @@ -172,10 +172,10 @@ int main(int argc, const char *argv[]) POPT_TABLEEND }; - const UnitTest tests[] = { - unit_test(test_run_as_root_fg), - unit_test(test_run_as_sssd_fg), - unit_test(test_run_as_root_daemon), + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_run_as_root_fg), + cmocka_unit_test(test_run_as_sssd_fg), + cmocka_unit_test(test_run_as_root_daemon), }; /* Set debug level to invalid value so we can deside if -d 0 was used. */ @@ -201,7 +201,7 @@ int main(int argc, const char *argv[]) test_dom_suite_cleanup(TEST_DB_PATH, CONFDB_FILE, NULL); test_dom_suite_setup(TEST_DB_PATH); - rv = run_tests(tests); + rv = cmocka_run_group_tests(tests, NULL, NULL); if (rv != 0) { test_dom_suite_cleanup(TEST_DB_PATH, CONFDB_FILE, NULL); } diff --git a/src/tests/cwrap/test_usertools.c b/src/tests/cwrap/test_usertools.c index 642305945..91eb2bc96 100644 --- a/src/tests/cwrap/test_usertools.c +++ b/src/tests/cwrap/test_usertools.c @@ -77,10 +77,10 @@ int main(int argc, const char *argv[]) POPT_TABLEEND }; - const UnitTest tests[] = { - unit_test(test_get_user_num), - unit_test(test_get_user_str), - unit_test(test_get_user_nullparm), + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_get_user_num), + cmocka_unit_test(test_get_user_str), + cmocka_unit_test(test_get_user_nullparm), }; /* Set debug level to invalid value so we can deside if -d 0 was used. */ @@ -102,5 +102,5 @@ int main(int argc, const char *argv[]) tests_set_cwd(); - return run_tests(tests); + return cmocka_run_group_tests(tests, NULL, NULL); } |