diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libs/zbxcommon/parse_key.c | 3 | ||||
-rw-r--r-- | tests/libs/zbxcommon/zbx_function_find.c | 36 | ||||
-rw-r--r-- | tests/libs/zbxcomms/zbx_tcp_check_allowed_peers.c | 3 | ||||
-rw-r--r-- | tests/libs/zbxdbcache/Makefile.am | 29 | ||||
-rw-r--r-- | tests/libs/zbxhistory/Makefile.am | 4 | ||||
-rwxr-xr-x | tests/libs/zbxserver/Makefile.am | 5 | ||||
-rw-r--r-- | tests/libs/zbxserver/evaluate_function.c | 2 | ||||
-rw-r--r-- | tests/libs/zbxsysinfo/Makefile.am | 4 | ||||
-rw-r--r-- | tests/libs/zbxsysinfo/common/Makefile.am | 8 | ||||
-rw-r--r-- | tests/mocks/configcache/configcache.c | 8 | ||||
-rw-r--r-- | tests/mocks/configcache/configcache_mock.h | 4 | ||||
-rw-r--r-- | tests/mocks/configcache/hosts.c | 2 | ||||
-rw-r--r-- | tests/mocks/configcache/usermacros.c | 2 | ||||
-rw-r--r-- | tests/mocks/valuecache/valuecache_mock.c | 6 | ||||
-rw-r--r-- | tests/mocks/valuecache/valuecache_mock.h | 2 | ||||
-rw-r--r-- | tests/zabbix_server/trapper/Makefile.am | 7 | ||||
-rw-r--r-- | tests/zbxmockutil.c | 6 |
17 files changed, 72 insertions, 59 deletions
diff --git a/tests/libs/zbxcommon/parse_key.c b/tests/libs/zbxcommon/parse_key.c index 09808c035b4..087c389548b 100644 --- a/tests/libs/zbxcommon/parse_key.c +++ b/tests/libs/zbxcommon/parse_key.c @@ -37,6 +37,7 @@ void zbx_mock_test_entry(void **state) ZBX_MOCK_SUCCESS != (error = zbx_mock_string(mh, &key))) { fail_msg("Cannot get 'key' from test case data: %s", zbx_mock_error_string(error)); + goto out; } /* mandatory output parameter "return" */ @@ -108,4 +109,6 @@ void zbx_mock_test_entry(void **state) if (0 != strcmp(expected_invalid_part, key_moving_pointer)) fail_msg("Got '%s' instead of '%s' as the invalid_part.", key_moving_pointer, expected_invalid_part); +out: + return; } diff --git a/tests/libs/zbxcommon/zbx_function_find.c b/tests/libs/zbxcommon/zbx_function_find.c index 18531b1e6d5..3223eb8fe3a 100644 --- a/tests/libs/zbxcommon/zbx_function_find.c +++ b/tests/libs/zbxcommon/zbx_function_find.c @@ -63,47 +63,53 @@ void zbx_mock_test_entry(void **state) zbx_uint32_t num; if (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("func_pos", ¶m_handle)) || - ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &tmp))) + ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &tmp))) { fail_msg("Cannot get expected 'func_pos' parameter from test case data: %s", zbx_mock_error_string(error)); + goto out; } - else if(SUCCEED != is_uint32(tmp, &num)) + else if (SUCCEED != is_uint32(tmp, &num)) { fail_msg("func_pos parameter \"%s\" is not numeric.", tmp); + goto out; } func_pos_exp = num; if (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("par_l", ¶m_handle)) || - ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &tmp))) + ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &tmp))) { fail_msg("Cannot get expected 'par_l' parameter from test case data: %s", - zbx_mock_error_string(error)); + zbx_mock_error_string(error)); + goto out; } - else if(SUCCEED != is_uint32(tmp, &num)) + else if (SUCCEED != is_uint32(tmp, &num)) { fail_msg("par_l parameter \"%s\" is not numeric.", tmp); + goto out; } par_l_exp = num; if (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("par_r", ¶m_handle)) || - ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &tmp))) + ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &tmp))) { fail_msg("Cannot get expected 'par_r' parameter from test case data: %s", - zbx_mock_error_string(error)); + zbx_mock_error_string(error)); + goto out; } - else if(SUCCEED != is_uint32(tmp, &num)) + else if (SUCCEED != is_uint32(tmp, &num)) { fail_msg("par_r parameter \"%s\" is not numeric.", tmp); + goto out; } par_r_exp = num; } if (FAIL == expected_result && (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("error", ¶m_handle)) || - ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &expected_param_value_string)))) + ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &expected_param_value_string)))) { fail_msg("Cannot get expected 'error' parameters from test case data: %s", zbx_mock_error_string(error)); @@ -113,7 +119,7 @@ void zbx_mock_test_entry(void **state) max_error_len))) { fail_msg("Got %s instead of %s as a result. Error: %s", zbx_result_string(actual_result), - zbx_result_string(expected_result), error_text); + zbx_result_string(expected_result), error_text); } if (SUCCEED == expected_result) @@ -121,27 +127,29 @@ void zbx_mock_test_entry(void **state) if (func_pos != func_pos_exp) { fail_msg("Position "ZBX_FS_SIZE_T" of 'function' not equal expected "ZBX_FS_SIZE_T". Error:%s", - (zbx_fs_size_t)func_pos, (zbx_fs_size_t)func_pos_exp, error_text); + (zbx_fs_size_t)func_pos, (zbx_fs_size_t)func_pos_exp, error_text); } if (par_l != par_l_exp) { fail_msg("Position "ZBX_FS_SIZE_T" of left '(' not equal expected "ZBX_FS_SIZE_T". Error:%s", - (zbx_fs_size_t)par_l, (zbx_fs_size_t)par_l_exp, error_text); + (zbx_fs_size_t)par_l, (zbx_fs_size_t)par_l_exp, error_text); } if (par_r != par_r_exp) { fail_msg("Position "ZBX_FS_SIZE_T" of right ')' not equal expected "ZBX_FS_SIZE_T". Error:%s", - (zbx_fs_size_t)par_r, (zbx_fs_size_t)par_r_exp, error_text); + (zbx_fs_size_t)par_r, (zbx_fs_size_t)par_r_exp, error_text); } } else /* FAIL == expected_result */ { if (0 != strcmp(expected_param_value_string, error_text)) { - fail_msg("Got\n'%s' instead of\n'%s' as a value.", error_text, + fail_msg("Got\n'%s' instead of\n'%s' as a value.", error_text, expected_param_value_string); } } +out: + return; } diff --git a/tests/libs/zbxcomms/zbx_tcp_check_allowed_peers.c b/tests/libs/zbxcomms/zbx_tcp_check_allowed_peers.c index fb1706560fd..b42cdf81456 100644 --- a/tests/libs/zbxcomms/zbx_tcp_check_allowed_peers.c +++ b/tests/libs/zbxcomms/zbx_tcp_check_allowed_peers.c @@ -41,12 +41,15 @@ static void mock_accept(zbx_socket_t *s) break; default: fail_msg("Unexpected family"); + goto out; } if (1 != inet_pton(s->peer_info.ss_family, (peer = zbx_mock_get_parameter_string("in.peer")), buf)) fail_msg("failed converting address '%s' from textual to binary", zbx_mock_get_parameter_string("in.peer")); zbx_strlcpy(s->peer, peer, sizeof(s->peer)); +out: + return; } void zbx_mock_test_entry(void **state) diff --git a/tests/libs/zbxdbcache/Makefile.am b/tests/libs/zbxdbcache/Makefile.am index 45db92a1921..72435065925 100644 --- a/tests/libs/zbxdbcache/Makefile.am +++ b/tests/libs/zbxdbcache/Makefile.am @@ -87,10 +87,9 @@ zbx_vc_get_values_SOURCES = \ ../../zbxmocktest.h zbx_vc_get_values_LDADD = $(VALUECACHE_LIBS) @SERVER_LIBS@ -zbx_vc_get_values_LDFLAGS = @SERVER_LDFLAGS@ +zbx_vc_get_values_LDFLAGS = @SERVER_LDFLAGS@ $(COMMON_WRAP_FUNCS) zbx_vc_get_values_CFLAGS = \ - $(COMMON_WRAP_FUNCS) \ -I@top_srcdir@/src/libs/zbxalgo \ -I@top_srcdir@/src/libs/zbxdbcache \ -I@top_srcdir@/src/libs/zbxhistory \ @@ -103,10 +102,9 @@ zbx_vc_add_values_SOURCES = \ ../../zbxmocktest.h zbx_vc_add_values_LDADD = $(VALUECACHE_LIBS) @SERVER_LIBS@ -zbx_vc_add_values_LDFLAGS = @SERVER_LDFLAGS@ +zbx_vc_add_values_LDFLAGS = @SERVER_LDFLAGS@ $(COMMON_WRAP_FUNCS) zbx_vc_add_values_CFLAGS = \ - $(COMMON_WRAP_FUNCS) \ -I@top_srcdir@/src/libs/zbxalgo \ -I@top_srcdir@/src/libs/zbxdbcache \ -I@top_srcdir@/src/libs/zbxhistory \ @@ -119,10 +117,9 @@ zbx_vc_get_value_SOURCES = \ ../../zbxmocktest.h zbx_vc_get_value_LDADD = $(VALUECACHE_LIBS) @SERVER_LIBS@ -zbx_vc_get_value_LDFLAGS = @SERVER_LDFLAGS@ +zbx_vc_get_value_LDFLAGS = @SERVER_LDFLAGS@ $(COMMON_WRAP_FUNCS) zbx_vc_get_value_CFLAGS = \ - $(COMMON_WRAP_FUNCS) \ -I@top_srcdir@/src/libs/zbxalgo \ -I@top_srcdir@/src/libs/zbxdbcache \ -I@top_srcdir@/src/libs/zbxhistory \ @@ -157,37 +154,35 @@ dc_item_poller_type_update_CFLAGS = -I@top_srcdir@/tests -I@top_srcdir@/src/libs dc_expand_user_macros_in_expression_CFLAGS = \ -I@top_srcdir@/tests \ -I@top_srcdir@/tests/mocks/configcache \ - -I@top_srcdir@/src/libs/zbxdbcache \ - -Wl,--wrap=zbx_hashset_search + -I@top_srcdir@/src/libs/zbxdbcache dc_expand_user_macros_in_expression_SOURCES = \ dc_expand_user_macros_in_expression.c dc_expand_user_macros_in_expression_LDADD = \ $(top_srcdir)/tests/mocks/configcache/libconfigcachemock.a \ $(CACHE_LIBS) @SERVER_LIBS@ -dc_expand_user_macros_in_expression_LDFLAGS = @SERVER_LDFLAGS@ - +dc_expand_user_macros_in_expression_LDFLAGS = @SERVER_LDFLAGS@ \ + -Wl,--wrap=zbx_hashset_search dc_expand_user_macros_in_func_params_CFLAGS = \ -I@top_srcdir@/tests \ -I@top_srcdir@/tests/mocks/configcache \ - -I@top_srcdir@/src/libs/zbxdbcache \ - -Wl,--wrap=zbx_hashset_search + -I@top_srcdir@/src/libs/zbxdbcache dc_expand_user_macros_in_func_params_SOURCES = \ dc_expand_user_macros_in_func_params.c dc_expand_user_macros_in_func_params_LDADD = \ $(top_srcdir)/tests/mocks/configcache/libconfigcachemock.a \ $(CACHE_LIBS) @SERVER_LIBS@ -dc_expand_user_macros_in_func_params_LDFLAGS = @SERVER_LDFLAGS@ - +dc_expand_user_macros_in_func_params_LDFLAGS = @SERVER_LDFLAGS@ \ + -Wl,--wrap=zbx_hashset_search dc_expand_user_macros_in_calcitem_CFLAGS = \ -I@top_srcdir@/tests \ -I@top_srcdir@/tests/mocks/configcache \ - -I@top_srcdir@/src/libs/zbxdbcache \ - -Wl,--wrap=zbx_hashset_search + -I@top_srcdir@/src/libs/zbxdbcache dc_expand_user_macros_in_calcitem_SOURCES = \ dc_expand_user_macros_in_calcitem.c dc_expand_user_macros_in_calcitem_LDADD = \ $(top_srcdir)/tests/mocks/configcache/libconfigcachemock.a \ $(CACHE_LIBS) @SERVER_LIBS@ -dc_expand_user_macros_in_calcitem_LDFLAGS = @SERVER_LDFLAGS@ +dc_expand_user_macros_in_calcitem_LDFLAGS = @SERVER_LDFLAGS@ \ + -Wl,--wrap=zbx_hashset_search endif diff --git a/tests/libs/zbxhistory/Makefile.am b/tests/libs/zbxhistory/Makefile.am index 503b2b0f39d..c1908706c59 100644 --- a/tests/libs/zbxhistory/Makefile.am +++ b/tests/libs/zbxhistory/Makefile.am @@ -37,10 +37,10 @@ zbx_history_get_values_WRAP = \ zbx_history_get_values_LDADD = $(HISTORY_LIBS) @SERVER_LIBS@ -zbx_history_get_values_LDFLAGS = @SERVER_LDFLAGS@ +zbx_history_get_values_LDFLAGS = @SERVER_LDFLAGS@ \ + $(zbx_history_get_values_WRAP) zbx_history_get_values_CFLAGS = \ - $(zbx_history_get_values_WRAP) \ -I@top_srcdir@/src/libs/zbxalgo \ -I@top_srcdir@/tests endif diff --git a/tests/libs/zbxserver/Makefile.am b/tests/libs/zbxserver/Makefile.am index f030a8e5181..d316271b156 100755 --- a/tests/libs/zbxserver/Makefile.am +++ b/tests/libs/zbxserver/Makefile.am @@ -115,7 +115,7 @@ evaluate_function_LDADD += $(COMMON_LIB_FILES) evaluate_function_LDADD += @SERVER_LIBS@ -evaluate_function_LDFLAGS = @SERVER_LDFLAGS@ +evaluate_function_LDFLAGS = @SERVER_LDFLAGS@ $(VALUECACHE_WRAP_FUNCS) VALUECACHE_WRAP_FUNCS = \ -Wl,--wrap=zbx_mutex_create \ @@ -137,7 +137,6 @@ VALUECACHE_WRAP_FUNCS = \ evaluate_function_CFLAGS = $(COMMON_COMPILER_FLAGS) \ -I@top_srcdir@/src/libs/zbxalgo \ -I@top_srcdir@/src/libs/zbxdbcache \ - -I@top_srcdir@/src/libs/zbxhistory \ - $(VALUECACHE_WRAP_FUNCS) + -I@top_srcdir@/src/libs/zbxhistory endif diff --git a/tests/libs/zbxserver/evaluate_function.c b/tests/libs/zbxserver/evaluate_function.c index f7edf171ebc..2d95e6afb55 100644 --- a/tests/libs/zbxserver/evaluate_function.c +++ b/tests/libs/zbxserver/evaluate_function.c @@ -43,6 +43,7 @@ int __wrap_substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *even ZBX_UNUSED(dc_item); ZBX_UNUSED(alert); ZBX_UNUSED(ack); + ZBX_UNUSED(tz); ZBX_UNUSED(data); ZBX_UNUSED(macro_type); ZBX_UNUSED(error); @@ -96,7 +97,6 @@ void zbx_mock_test_entry(void **state) if (SUCCEED == expected_ret) { - zbx_mock_handle_t handle; const char *expected_value; char *ptr; double expected_dbl; diff --git a/tests/libs/zbxsysinfo/Makefile.am b/tests/libs/zbxsysinfo/Makefile.am index 5bb83ebfa8e..a721aa4bbcb 100644 --- a/tests/libs/zbxsysinfo/Makefile.am +++ b/tests/libs/zbxsysinfo/Makefile.am @@ -140,9 +140,9 @@ process_WRAP_FUNCS = \ process_LDADD += @AGENT_LIBS@ -process_LDFLAGS = @AGENT_LDFLAGS@ +process_LDFLAGS = @AGENT_LDFLAGS@ $(process_WRAP_FUNCS) -process_CFLAGS = $(process_WRAP_FUNCS) -DZABBIX_DAEMON -I@top_srcdir@/tests +process_CFLAGS = -DZABBIX_DAEMON -I@top_srcdir@/tests # check_key_access_rules diff --git a/tests/libs/zbxsysinfo/common/Makefile.am b/tests/libs/zbxsysinfo/common/Makefile.am index 2c0e9e7075c..a887f4e37c3 100644 --- a/tests/libs/zbxsysinfo/common/Makefile.am +++ b/tests/libs/zbxsysinfo/common/Makefile.am @@ -53,9 +53,9 @@ SYSTEM_LOCALTIME_LDADD = \ SYSTEM_LOCALTIME_LDADD += @AGENT_LIBS@ -SYSTEM_LOCALTIME_LDFLAGS = @AGENT_LDFLAGS@ +SYSTEM_LOCALTIME_LDFLAGS = @AGENT_LDFLAGS@ $(SYSTEM_LOCALTIME_WRAP_FUNCS) -SYSTEM_LOCALTIME_CFLAGS = $(SYSTEM_LOCALTIME_WRAP_FUNCS) $(COMMON_COMPILER_FLAGS) +SYSTEM_LOCALTIME_CFLAGS = $(COMMON_COMPILER_FLAGS) WEB_PAGE_GET_SOURCES = \ WEB_PAGE_GET.c \ @@ -80,9 +80,9 @@ WEB_PAGE_GET_LDADD = \ WEB_PAGE_GET_LDADD += @AGENT_LIBS@ -WEB_PAGE_GET_LDFLAGS = @AGENT_LDFLAGS@ +WEB_PAGE_GET_LDFLAGS = @AGENT_LDFLAGS@ $(WEB_PAGE_GET_WRAP_FUNCS) -WEB_PAGE_GET_CFLAGS = $(WEB_PAGE_GET_WRAP_FUNCS) $(COMMON_COMPILER_FLAGS) +WEB_PAGE_GET_CFLAGS = $(COMMON_COMPILER_FLAGS) VFS_FILE_EXISTS_SOURCES = \ VFS_FILE_EXISTS.c \ diff --git a/tests/mocks/configcache/configcache.c b/tests/mocks/configcache/configcache.c index a1ac014cd53..e05a0573e8b 100644 --- a/tests/mocks/configcache/configcache.c +++ b/tests/mocks/configcache/configcache.c @@ -37,8 +37,8 @@ zbx_mock_config_t mock_config; void *__real_zbx_hashset_search(zbx_hashset_t *hs, const void *data); -void mock_config_free_user_macros(); -void mock_config_free_hosts(); +void mock_config_free_user_macros(void); +void mock_config_free_hosts(void); void *__wrap_zbx_hashset_search(zbx_hashset_t *hs, const void *data) { @@ -121,13 +121,13 @@ void free_string(const char *str) zbx_free(ptr); } -void mock_config_init() +void mock_config_init(void) { memset(&mock_config, 0, sizeof(mock_config)); config = &mock_config.dc; } -void mock_config_free() +void mock_config_free(void) { if (0 != (mock_config.initialized & ZBX_MOCK_CONFIG_USERMACROS)) mock_config_free_user_macros(); diff --git a/tests/mocks/configcache/configcache_mock.h b/tests/mocks/configcache/configcache_mock.h index c6acab24917..4f693ab253f 100644 --- a/tests/mocks/configcache/configcache_mock.h +++ b/tests/mocks/configcache/configcache_mock.h @@ -31,8 +31,8 @@ #ifndef ZABBIX_CONFIGCACHE_MOCK_H #define ZABBIX_CONFIGCACHE_MOCK_H -void mock_config_init(); -void mock_config_free(); +void mock_config_init(void); +void mock_config_free(void); void mock_config_load_user_macros(const char *path); void mock_config_load_hosts(const char *path); diff --git a/tests/mocks/configcache/hosts.c b/tests/mocks/configcache/hosts.c index 1d3cb63864f..420a6be6b48 100644 --- a/tests/mocks/configcache/hosts.c +++ b/tests/mocks/configcache/hosts.c @@ -79,7 +79,7 @@ void mock_config_load_hosts(const char *path) mock_config.initialized |= ZBX_MOCK_CONFIG_HOSTS; } -void mock_config_free_hosts() +void mock_config_free_hosts(void) { int i; diff --git a/tests/mocks/configcache/usermacros.c b/tests/mocks/configcache/usermacros.c index be28d2d7e05..33866f3bfd7 100644 --- a/tests/mocks/configcache/usermacros.c +++ b/tests/mocks/configcache/usermacros.c @@ -180,7 +180,7 @@ void mock_config_load_user_macros(const char *path) mock_config.initialized |= ZBX_MOCK_CONFIG_USERMACROS; } -void mock_config_free_user_macros() +void mock_config_free_user_macros(void) { int i, j; diff --git a/tests/mocks/valuecache/valuecache_mock.c b/tests/mocks/valuecache/valuecache_mock.c index cd33996b1d4..ff21d2d5d08 100644 --- a/tests/mocks/valuecache/valuecache_mock.c +++ b/tests/mocks/valuecache/valuecache_mock.c @@ -730,8 +730,8 @@ void zbx_vcmock_set_cache_size(zbx_mock_handle_t hitem, const char *key) { if (ZBX_MOCK_SUCCESS != zbx_mock_string(hmem, &data) || SUCCEED != is_uint64(data, &cache_size)) fail_msg("Cannot read \"%s\" parameter", key); - - zbx_vcmock_set_available_mem(cache_size); + else + zbx_vcmock_set_available_mem(cache_size); } } @@ -830,7 +830,7 @@ void zbx_vcmock_set_time(zbx_mock_handle_t hitem, const char *key) * Purpose: returns the mocked current time * * * ******************************************************************************/ -zbx_timespec_t zbx_vcmock_get_ts() +zbx_timespec_t zbx_vcmock_get_ts(void) { return vcmock_ts; } diff --git a/tests/mocks/valuecache/valuecache_mock.h b/tests/mocks/valuecache/valuecache_mock.h index d3c748b52ea..f039327841e 100644 --- a/tests/mocks/valuecache/valuecache_mock.h +++ b/tests/mocks/valuecache/valuecache_mock.h @@ -52,7 +52,7 @@ void zbx_vcmock_set_available_mem(size_t size); size_t zbx_vcmock_get_available_mem(void); void zbx_vcmock_set_time(zbx_mock_handle_t hitem, const char *key); -zbx_timespec_t zbx_vcmock_get_ts(); +zbx_timespec_t zbx_vcmock_get_ts(void); void zbx_vcmock_set_cache_size(zbx_mock_handle_t hitem, const char *key); void zbx_vcmock_get_request_params(zbx_mock_handle_t handle, zbx_uint64_t *itemid, unsigned char *value_type, int *seconds, int *count, zbx_timespec_t *end); diff --git a/tests/zabbix_server/trapper/Makefile.am b/tests/zabbix_server/trapper/Makefile.am index 06437cbdb77..2b55e995a81 100644 --- a/tests/zabbix_server/trapper/Makefile.am +++ b/tests/zabbix_server/trapper/Makefile.am @@ -39,12 +39,11 @@ zbx_trapper_preproc_test_run_SOURCES = \ zbx_trapper_preproc_test_run_LDADD = $(TRAPPER_LIBS) zbx_trapper_preproc_test_run_LDADD += @SERVER_LIBS@ -zbx_trapper_preproc_test_run_LDFLAGS = @SERVER_LDFLAGS@ - -zbx_trapper_preproc_test_run_CFLAGS = \ - -I@top_srcdir@/tests @LIBXML2_CFLAGS@ \ +zbx_trapper_preproc_test_run_LDFLAGS = @SERVER_LDFLAGS@ \ -Wl,--wrap=zbx_preprocessor_test \ -Wl,--wrap=DBget_user_by_active_session +zbx_trapper_preproc_test_run_CFLAGS = \ + -I@top_srcdir@/tests @LIBXML2_CFLAGS@ endif diff --git a/tests/zbxmockutil.c b/tests/zbxmockutil.c index 93272dbf99c..4b6589c4d1b 100644 --- a/tests/zbxmockutil.c +++ b/tests/zbxmockutil.c @@ -36,6 +36,7 @@ const char *zbx_mock_get_parameter_string(const char *path) if (ZBX_MOCK_SUCCESS != (err = zbx_mock_parameter(path, &handle)) || ZBX_MOCK_SUCCESS != (err = zbx_mock_string(handle, ¶meter))) { + parameter = NULL; fail_msg("Cannot read parameter at \"%s\": %s", path, zbx_mock_error_string(err)); } @@ -51,6 +52,7 @@ const char *zbx_mock_get_object_member_string(zbx_mock_handle_t object, const ch if (ZBX_MOCK_SUCCESS != (err = zbx_mock_object_member(object, name, &handle)) || ZBX_MOCK_SUCCESS != (err = zbx_mock_string(handle, &member))) { + member = NULL; fail_msg("Cannot read object member \"%s\": %s", name, zbx_mock_error_string(err)); } @@ -242,6 +244,7 @@ zbx_uint64_t zbx_mock_get_parameter_uint64(const char *path) if (ZBX_MOCK_SUCCESS != (err = zbx_mock_parameter(path, &handle)) || ZBX_MOCK_SUCCESS != (err = zbx_mock_uint64(handle, ¶meter))) { + parameter = 0; fail_msg("Cannot read parameter at \"%s\": %s", path, zbx_mock_error_string(err)); } @@ -257,6 +260,7 @@ zbx_uint64_t zbx_mock_get_object_member_uint64(zbx_mock_handle_t object, const c if (ZBX_MOCK_SUCCESS != (err = zbx_mock_object_member(object, name, &handle)) || ZBX_MOCK_SUCCESS != (err = zbx_mock_uint64(handle, &member))) { + member = 0; fail_msg("Cannot read object member \"%s\": %s", name, zbx_mock_error_string(err)); } @@ -272,6 +276,7 @@ double zbx_mock_get_parameter_float(const char *path) if (ZBX_MOCK_SUCCESS != (err = zbx_mock_parameter(path, &handle)) || ZBX_MOCK_SUCCESS != (err = zbx_mock_float(handle, ¶meter))) { + parameter = 0.0; fail_msg("Cannot read parameter at \"%s\": %s", path, zbx_mock_error_string(err)); } @@ -287,6 +292,7 @@ double zbx_mock_get_object_member_float(zbx_mock_handle_t object, const char *na if (ZBX_MOCK_SUCCESS != (err = zbx_mock_object_member(object, name, &handle)) || ZBX_MOCK_SUCCESS != (err = zbx_mock_float(handle, &member))) { + member = 0.0; fail_msg("Cannot read object member \"%s\": %s", name, zbx_mock_error_string(err)); } |