Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libs/zbxsysinfo/linux/KERNEL_MAXPROC.c')
-rw-r--r--tests/libs/zbxsysinfo/linux/KERNEL_MAXPROC.c73
1 files changed, 2 insertions, 71 deletions
diff --git a/tests/libs/zbxsysinfo/linux/KERNEL_MAXPROC.c b/tests/libs/zbxsysinfo/linux/KERNEL_MAXPROC.c
index 692a4345f5d..eb99ce00492 100644
--- a/tests/libs/zbxsysinfo/linux/KERNEL_MAXPROC.c
+++ b/tests/libs/zbxsysinfo/linux/KERNEL_MAXPROC.c
@@ -17,79 +17,10 @@
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
+#include "KERNEL_COMMON.h"
#include "zbxmocktest.h"
-#include "zbxmockdata.h"
-
-#include "common.h"
-#include "sysinfo.h"
void zbx_mock_test_entry(void **state)
{
- AGENT_REQUEST request;
- AGENT_RESULT param_result;
- zbx_mock_error_t error;
- zbx_mock_handle_t param_handle;
- const char *expected_param_value_string, *expected_return_string;
- zbx_uint64_t expected_param_value = 0;
- int expected_result = SYSINFO_RET_FAIL, actual_result;
-
- ZBX_UNUSED(state);
-
- if (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("return", &param_handle)) ||
- ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &expected_return_string)))
- {
- fail_msg("Cannot get expected 'return' parameter from test case data: %s", zbx_mock_error_string(error));
- }
-
- if (0 == strcmp("SYSINFO_RET_OK", expected_return_string))
- expected_result = SYSINFO_RET_OK;
- else if (0 == strcmp("SYSINFO_RET_FAIL", expected_return_string))
- expected_result = SYSINFO_RET_FAIL;
- else
- fail_msg("Get unexpected 'return' parameter from test case data: %s", expected_return_string);
-
- if (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("result", &param_handle)) ||
- ZBX_MOCK_SUCCESS != (error = zbx_mock_string(param_handle, &expected_param_value_string)))
- {
- fail_msg("Cannot get expected 'result' parameter from test case data: %s", zbx_mock_error_string(error));
- }
-
- if (FAIL == is_uint64(expected_param_value_string, &expected_param_value) && SYSINFO_RET_OK == expected_result)
- fail_msg("Cannot get expected numeric parameter from test case data: %s", expected_param_value_string);
-
- init_request(&request);
- init_result(&param_result);
-
- if (expected_result != (actual_result = KERNEL_MAXPROC(&request, &param_result)))
- {
- fail_msg("Got %s instead of %s as a result.", zbx_sysinfo_ret_string(actual_result),
- zbx_sysinfo_ret_string(expected_result));
- }
-
- if (SYSINFO_RET_OK == expected_result)
- {
- if (NULL == GET_UI64_RESULT(&param_result))
- fail_msg("Got 'NULL' instead of '%s' as a value.", expected_param_value_string);
-
- if (expected_param_value != *GET_UI64_RESULT(&param_result))
- {
- fail_msg("Got '" ZBX_FS_UI64 "' instead of '%s' as a value.", *GET_UI64_RESULT(&param_result),
- expected_param_value_string);
- }
- }
-
- if (SYSINFO_RET_FAIL == expected_result)
- {
- if (NULL == GET_MSG_RESULT(&param_result) || 0 != strcmp(expected_param_value_string,
- *GET_MSG_RESULT(&param_result)))
- {
- fail_msg("Got '%s' instead of '%s' as a value.",
- (NULL != GET_MSG_RESULT(&param_result) ?
- *GET_MSG_RESULT(&param_result) : "NULL"),
- expected_param_value_string);
- }
- }
-
- free_request(&request);
- free_result(&param_result);
+ zbx_mock_test_entry_KERNEL_COMMON(state, ZABBIX_MOCK_KERNEL_MAXPROC);
}