ehlo, The cmocka-1.0 introduced new interface for tests which is not compatible with the old one. And the old interface is deprecated which caused compiled warnings.
LS
>From 15c7610984f8561bceca2a729fc4cc7e81a1d2b1 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Thu, 12 Nov 2015 19:43:56 +0000 Subject: [PATCH 6/8] cmocka_tests: Do not use deprecated cmocka interface The cmocka-1.0 introduced new interface for tests which is not compatible with the old one. And the old interface is deprecated which caused compiled warnings. --- daemons/ipa-kdb/tests/ipa_kdb_tests.c | 23 ++++++++++------ .../ipa-slapi-plugins/ipa-cldap/ipa_cldap_tests.c | 6 ++-- .../ipa-extdom-extop/ipa_extdom_cmocka_tests.c | 32 ++++++++++++---------- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/daemons/ipa-kdb/tests/ipa_kdb_tests.c b/daemons/ipa-kdb/tests/ipa_kdb_tests.c index 7483a1799d4c8462f212ff6e8e4140c1c053d6a7..5bc89e23410de4f779db44a9f2cf50bf521ef403 100644 --- a/daemons/ipa-kdb/tests/ipa_kdb_tests.c +++ b/daemons/ipa-kdb/tests/ipa_kdb_tests.c @@ -72,7 +72,7 @@ struct test_ctx { #define DOM_SID_TRUST "S-1-5-21-4-5-6" #define BLACKLIST_SID "S-1-5-1" -void setup(void **state) +static int setup(void **state) { int ret; krb5_context krb5_ctx; @@ -136,9 +136,11 @@ void setup(void **state) test_ctx->krb5_ctx = krb5_ctx; *state = test_ctx; + + return 0; } -void teardown(void **state) +static int teardown(void **state) { struct test_ctx *test_ctx; struct ipadb_context *ipa_ctx; @@ -153,6 +155,8 @@ void teardown(void **state) krb5_free_context(test_ctx->krb5_ctx); talloc_free(test_ctx); + + return 0; } extern krb5_error_code filter_logon_info(krb5_context context, @@ -468,12 +472,15 @@ void test_dom_sid_string(void **state) int main(int argc, const char *argv[]) { - const UnitTest tests[] = { - unit_test_setup_teardown(test_get_authz_data_types, setup, teardown), - unit_test_setup_teardown(test_filter_logon_info, setup, teardown), - unit_test(test_string_to_sid), - unit_test_setup_teardown(test_dom_sid_string, setup, teardown), + const struct CMUnitTest tests[] = { + cmocka_unit_test_setup_teardown(test_get_authz_data_types, + setup, teardown), + cmocka_unit_test_setup_teardown(test_filter_logon_info, + setup, teardown), + cmocka_unit_test(test_string_to_sid), + cmocka_unit_test_setup_teardown(test_dom_sid_string, + setup, teardown), }; - return run_tests(tests); + return cmocka_run_group_tests(tests, NULL, NULL); } diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_tests.c b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_tests.c index 8f579cb0c051551471a55273c4bce97717200ffd..48b9636fa4c7cc8d545f6adeb4283bfdf6472c2a 100644 --- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_tests.c +++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_tests.c @@ -59,10 +59,10 @@ void test_make_netbios_name(void **state) int main(int argc, const char *argv[]) { - const UnitTest tests[] = { - unit_test(test_make_netbios_name), + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_make_netbios_name), }; - return run_tests(tests); + return cmocka_run_group_tests(tests, NULL, NULL); } diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c index ec553fe62c27738f258defc267fe761c72157df0..526f903d2416e62ee5781909c234bd5ee2d89183 100644 --- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c +++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c @@ -258,7 +258,7 @@ struct test_data { struct ipa_extdom_ctx *ctx; }; -void extdom_req_setup(void **state) +static int extdom_req_setup(void **state) { struct test_data *test_data; @@ -272,9 +272,11 @@ void extdom_req_setup(void **state) assert_non_null(test_data->req); *state = test_data; + + return 0; } -void extdom_req_teardown(void **state) +static int extdom_req_teardown(void **state) { struct test_data *test_data; @@ -283,6 +285,8 @@ void extdom_req_teardown(void **state) free_req_data(test_data->req); free(test_data->ctx); free(test_data); + + return 0; } void test_set_err_msg(void **state) @@ -433,18 +437,18 @@ void test_decode(void **state) int main(int argc, const char *argv[]) { - const UnitTest tests[] = { - unit_test(test_getpwnam_r_wrapper), - unit_test(test_getpwuid_r_wrapper), - unit_test(test_getgrnam_r_wrapper), - unit_test(test_getgrgid_r_wrapper), - unit_test(test_get_user_grouplist), - unit_test_setup_teardown(test_set_err_msg, - extdom_req_setup, extdom_req_teardown), - unit_test_setup_teardown(test_encode, - extdom_req_setup, extdom_req_teardown), - unit_test(test_decode), + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_getpwnam_r_wrapper), + cmocka_unit_test(test_getpwuid_r_wrapper), + cmocka_unit_test(test_getgrnam_r_wrapper), + cmocka_unit_test(test_getgrgid_r_wrapper), + cmocka_unit_test(test_get_user_grouplist), + cmocka_unit_test_setup_teardown(test_set_err_msg, + extdom_req_setup, extdom_req_teardown), + cmocka_unit_test_setup_teardown(test_encode, + extdom_req_setup, extdom_req_teardown), + cmocka_unit_test(test_decode), }; - return run_tests(tests); + return cmocka_run_group_tests(tests, NULL, NULL); } -- 2.5.0
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code