From ab105d1671789fc9bd649f7e9ce3e6af22d30f0e Mon Sep 17 00:00:00 2001 From: Manikandan C Date: Wed, 19 Dec 2018 16:10:41 +0100 Subject: Cleanup of unit test fixes Signed-off-by: Manikandan C --- src/daemon/CMakeLists.txt | 10 ---- .../dlt_daemon_offline_logstorage_internal.h | 11 ++-- src/gateway/dlt_gateway.c | 67 ++++++++++++---------- src/gateway/dlt_gateway.h | 3 - src/gateway/dlt_gateway_internal.h | 51 ++++++++-------- src/lib/dlt_client.c | 22 ++++--- src/lib/dlt_user.c | 28 ++++----- src/offlinelogstorage/dlt_offline_logstorage.c | 3 + .../dlt_offline_logstorage_behavior.c | 5 +- .../dlt_offline_logstorage_behavior_internal.h | 11 ++-- src/tests/dlt-test-stress-client.c | 3 + tests/dlt_test_receiver.c | 12 +++- tests/gtest_dlt_daemon_event_handler.cpp | 10 ++-- tests/gtest_dlt_daemon_offline_log.cpp | 17 ++---- tests/start_multinode_test.sh | 9 --- 15 files changed, 130 insertions(+), 132 deletions(-) diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index a2f6e38..e9fb2ba 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -45,15 +45,6 @@ install(TARGETS dlt-daemon COMPONENT base) if (WITH_DLT_UNIT_TESTS) - if (WITH_DLT_FILTER_BACKEND_PROP) - add_library(dlt_daemon ${dlt_daemon_SRCS} ${dlt_prop_backend_SRCS} ${systemd_SRCS}) - target_link_libraries(dlt_daemon ald_plugin rt ${CMAKE_THREAD_LIBS_INIT}) - install(TARGETS dlt_daemon - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static - COMPONENT base) - else() add_library(dlt_daemon ${dlt_daemon_SRCS}) target_link_libraries(dlt_daemon ${RT_LIBRARY} ${SOCKET_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS dlt_daemon @@ -61,7 +52,6 @@ if (WITH_DLT_UNIT_TESTS) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static COMPONENT base) - endif(WITH_DLT_FILTER_BACKEND_PROP) endif(WITH_DLT_UNIT_TESTS) INSTALL(FILES dlt.conf diff --git a/src/daemon/dlt_daemon_offline_logstorage_internal.h b/src/daemon/dlt_daemon_offline_logstorage_internal.h index 4c1f828..cf5c593 100644 --- a/src/daemon/dlt_daemon_offline_logstorage_internal.h +++ b/src/daemon/dlt_daemon_offline_logstorage_internal.h @@ -1,6 +1,6 @@ /** * @licence app begin@ - * Copyright (C) 2017 Advanced Driver Information Technology. + * Copyright (C) 2018 Advanced Driver Information Technology. * This code is developed by Advanced Driver Information Technology. * Copyright of Advanced Driver Information Technology, Bosch and DENSO. * @@ -12,7 +12,7 @@ * this file, You can obtain one at http://mozilla.org/MPL/2.0/. * * - * \author Aditya Paluri ADIT 2017 + * \author Aditya Paluri ADIT 2018 * * \file: dlt_daemon_offline_logstorage_internal.h * For further information see http://www.genivi.org/. @@ -50,7 +50,10 @@ #ifndef DLT_DAEMON_OFFLINE_LOGSTORAGE_INTERNAL_H #define DLT_DAEMON_OFFLINE_LOGSTORAGE_INTERNAL_H -DLT_STATIC DltReturnValue dlt_logstorage_split_key(char *key, char *appid, char *ctxid, char *ecuid); +DLT_STATIC DltReturnValue dlt_logstorage_split_key(char *key, + char *appid, + char *ctxid, + char *ecuid); DltReturnValue dlt_logstorage_update_all_contexts(DltDaemon *daemon, DltDaemonLocal *daemon_local, @@ -68,7 +71,7 @@ DltReturnValue dlt_logstorage_update_context(DltDaemon *daemon, int curr_log_level, int verbose); -int dlt_logstorage_update_context_loglevel(DltDaemon *daemon, +DltReturnValue dlt_logstorage_update_context_loglevel(DltDaemon *daemon, DltDaemonLocal *daemon_local, char *key, int curr_log_level, diff --git a/src/gateway/dlt_gateway.c b/src/gateway/dlt_gateway.c index 7597b70..2bc535e 100644 --- a/src/gateway/dlt_gateway.c +++ b/src/gateway/dlt_gateway.c @@ -54,7 +54,7 @@ * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ DLT_STATIC DltReturnValue dlt_gateway_check_ip(DltGatewayConnection *con, char *value) { @@ -95,9 +95,10 @@ DLT_STATIC DltReturnValue dlt_gateway_check_ip(DltGatewayConnection *con, char * * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_port(DltGatewayConnection *con, char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_port(DltGatewayConnection *con, + char *value) { int tmp = -1; @@ -128,9 +129,10 @@ DLT_STATIC int dlt_gateway_check_port(DltGatewayConnection *con, char *value) * * @param con DltGatewayConnection to be updated * @param value string to be used as ECU identifier - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_ecu(DltGatewayConnection *con, char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_ecu(DltGatewayConnection *con, + char *value) { if ((con == NULL) || (value == NULL)) { @@ -153,10 +155,10 @@ DLT_STATIC int dlt_gateway_check_ecu(DltGatewayConnection *con, char *value) * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_connect_trigger(DltGatewayConnection *con, - char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_connect_trigger(DltGatewayConnection *con, + char *value) { if ((con == NULL) || (value == NULL)) { @@ -187,9 +189,10 @@ DLT_STATIC int dlt_gateway_check_connect_trigger(DltGatewayConnection *con, * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_timeout(DltGatewayConnection *con, char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_timeout(DltGatewayConnection *con, + char *value) { if ((con == NULL) || (value == NULL)) { @@ -212,9 +215,10 @@ DLT_STATIC int dlt_gateway_check_timeout(DltGatewayConnection *con, char *value) * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_send_serial(DltGatewayConnection *con, char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_send_serial(DltGatewayConnection *con, + char *value) { if ((con == NULL) || (value == NULL)) { @@ -231,9 +235,9 @@ DLT_STATIC int dlt_gateway_check_send_serial(DltGatewayConnection *con, char *va * Allocate passive control messages * * @param con DltGatewayConnection to be updated - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_allocate_control_messages(DltGatewayConnection *con) +DLT_STATIC DltReturnValue dlt_gateway_allocate_control_messages(DltGatewayConnection *con) { if (con == NULL) { @@ -274,10 +278,10 @@ DLT_STATIC int dlt_gateway_allocate_control_messages(DltGatewayConnection *con) * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_control_messages(DltGatewayConnection *con, - char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_control_messages(DltGatewayConnection *con, + char *value) { /* list of allowed clients given */ char *token = NULL; @@ -349,10 +353,11 @@ DLT_STATIC int dlt_gateway_check_control_messages(DltGatewayConnection *con, * * @param con DltGatewayConnection to be updated * @param value string to be tested - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_periodic_control_messages(DltGatewayConnection *con, - char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_periodic_control_messages( + DltGatewayConnection *con, + char *value) { char *token = NULL; char *rest = NULL; @@ -530,12 +535,12 @@ DLT_STATIC DltGatewayConf configuration_entries[GW_CONF_COUNT] = * @param c DltGatewayConnection * @param key DltGatwayConnection property * @param value specified property value from configuration file - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_check_param(DltGateway *gateway, - DltGatewayConnection *con, - DltGatewayConfType ctype, - char *value) +DLT_STATIC DltReturnValue dlt_gateway_check_param(DltGateway *gateway, + DltGatewayConnection *con, + DltGatewayConfType ctype, + char *value) { if ((gateway == NULL) || (con == NULL) || (value == NULL)) { @@ -1030,13 +1035,13 @@ DltReceiver *dlt_gateway_get_connection_receiver(DltGateway *gateway, int fd) * @param msg DltMessage * @param req 1 if requested from gateway, 0 otherwise * @param verbose verbose flag - * @return 0 on success, -1 otherwise + * @return Value from DltReturnValue enum */ -DLT_STATIC int dlt_gateway_parse_get_log_info(DltDaemon *daemon, - char *ecu, - DltMessage *msg, - int req, - int verbose) +DLT_STATIC DltReturnValue dlt_gateway_parse_get_log_info(DltDaemon *daemon, + char *ecu, + DltMessage *msg, + int req, + int verbose) { char resp_text[DLT_RECEIVE_BUFSIZE] = {'\0'}; DltServiceGetLogInfoResponse *resp = NULL; diff --git a/src/gateway/dlt_gateway.h b/src/gateway/dlt_gateway.h index 7108253..553b9b1 100644 --- a/src/gateway/dlt_gateway.h +++ b/src/gateway/dlt_gateway.h @@ -188,7 +188,4 @@ DltGatewayConnection *dlt_gateway_get_connection(DltGateway *g, char *ecu, int verbose); -/* _ONLY_ for development purposes */ -void print_gateway_connection_details(const DltGateway *g); - #endif diff --git a/src/gateway/dlt_gateway_internal.h b/src/gateway/dlt_gateway_internal.h index 3b665e1..c0f9241 100644 --- a/src/gateway/dlt_gateway_internal.h +++ b/src/gateway/dlt_gateway_internal.h @@ -2,7 +2,7 @@ * @licence app begin@ * SPDX license identifier: MPL-2.0 * - * Copyright (C) 2017 Advanced Driver Information Technology. + * Copyright (C) 2018 Advanced Driver Information Technology. * This code is developed by Advanced Driver Information Technology. * Copyright of Advanced Driver Information Technology, Bosch and DENSO. * @@ -21,7 +21,7 @@ * \author * Aditya Paluri * - * \copyright Copyright © 2017 Advanced Driver Information Technology. \n + * \copyright Copyright © 2018 Advanced Driver Information Technology. \n * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/. * * \file dlt_gateway_internal.h @@ -58,31 +58,36 @@ #ifndef DLT_GATEWAY_INTERNAL_H_ #define DLT_GATEWAY_INTERNAL_H_ -DLT_STATIC int dlt_gateway_check_ip(DltGatewayConnection *con, char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_ip(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_port(DltGatewayConnection *con, char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_port(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_ecu(DltGatewayConnection *con, char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_ecu(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_connect_trigger(DltGatewayConnection *con, - char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_connect_trigger(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_timeout(DltGatewayConnection *con, char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_timeout(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_send_serial(DltGatewayConnection *con, char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_send_serial(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_allocate_control_messages(DltGatewayConnection *con); +DLT_STATIC DltReturnValue dlt_gateway_allocate_control_messages(DltGatewayConnection *con); -DLT_STATIC int dlt_gateway_check_control_messages(DltGatewayConnection *con, - char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_control_messages(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_periodic_control_messages(DltGatewayConnection *con, - char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_periodic_control_messages(DltGatewayConnection *con, + char *value); -DLT_STATIC int dlt_gateway_check_param(DltGateway *gateway, - DltGatewayConnection *con, - DltGatewayConfType ctype, - char *value); +DLT_STATIC DltReturnValue dlt_gateway_check_param(DltGateway *gateway, + DltGatewayConnection *con, + DltGatewayConfType ctype, + char *value); int dlt_gateway_configure(DltGateway *gateway, char *config_file, int verbose); @@ -90,10 +95,10 @@ int dlt_gateway_store_connection(DltGateway *gateway, DltGatewayConnection *tmp, int verbose); -DLT_STATIC int dlt_gateway_parse_get_log_info(DltDaemon *daemon, - char *ecu, - DltMessage *msg, - int req, - int verbose); +DLT_STATIC DltReturnValue dlt_gateway_parse_get_log_info(DltDaemon *daemon, + char *ecu, + DltMessage *msg, + int req, + int verbose); #endif diff --git a/src/lib/dlt_client.c b/src/lib/dlt_client.c index cfe38ea..4723e00 100644 --- a/src/lib/dlt_client.c +++ b/src/lib/dlt_client.c @@ -322,13 +322,21 @@ DltReturnValue dlt_client_cleanup(DltClient *client, int verbose) dlt_vlog(LOG_WARNING, "Failed to free receiver\n"); ret = DLT_RETURN_ERROR; } - - free(client->serialDevice); - client->serialDevice = NULL; - free(client->servIP); - client->servIP = NULL; - free(client->socketPath); - client->socketPath = NULL; + if (client->serialDevice) + { + free(client->serialDevice); + client->serialDevice = NULL; + } + if (client->servIP) + { + free(client->servIP); + client->servIP = NULL; + } + if (client->socketPath) + { + free(client->socketPath); + client->socketPath = NULL; + } return ret; } diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index ceea2ea..418e1cf 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -1064,16 +1064,11 @@ DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, c } } - DLT_SEM_LOCK(); - if ((contextid == NULL) || (contextid[0] == '\0')) { - DLT_SEM_FREE(); return DLT_RETURN_WRONG_PARAMETER; } - DLT_SEM_FREE(); - return dlt_register_context_ll_ts(handle, contextid, description, DLT_USER_LOG_LEVEL_NOT_SET, DLT_USER_TRACE_STATUS_NOT_SET); } @@ -1091,12 +1086,7 @@ DltReturnValue dlt_register_context_ll_ts_llccb(DltContext *handle, int envLogLevel = DLT_USER_LOG_LEVEL_NOT_SET; //check nullpointer - if (!handle) - { - return DLT_RETURN_WRONG_PARAMETER; - } - - if ((contextid == NULL) || (contextid[0] == '\0')) + if ((handle ==NULL) || (contextid == NULL) || (contextid[0] == '\0')) { return DLT_RETURN_WRONG_PARAMETER; } @@ -1173,7 +1163,7 @@ DltReturnValue dlt_register_context_ll_ts_llccb(DltContext *handle, old_ll_ts = dlt_user.dlt_ll_ts; old_max_entries = dlt_user.dlt_ll_ts_max_num_entries; - dlt_user.dlt_ll_ts_max_num_entries = ((dlt_user.dlt_ll_ts_num_entries + dlt_user.dlt_ll_ts_max_num_entries = ((dlt_user.dlt_ll_ts_num_entries / DLT_USER_CONTEXT_ALLOC_SIZE) + 1) * DLT_USER_CONTEXT_ALLOC_SIZE; dlt_user.dlt_ll_ts = (dlt_ll_ts_type*) malloc(sizeof(dlt_ll_ts_type)* @@ -1294,8 +1284,10 @@ DltReturnValue dlt_register_context_ll_ts_llccb(DltContext *handle, return dlt_user_log_send_register_context(&log); } -DltReturnValue dlt_register_context_ll_ts(DltContext *handle, const char *contextid, - const char * description, int loglevel, +DltReturnValue dlt_register_context_ll_ts(DltContext *handle, + const char *contextid, + const char * description, + int loglevel, int tracestatus) { return dlt_register_context_ll_ts_llccb(handle, @@ -3370,7 +3362,7 @@ DltReturnValue dlt_log_string(DltContext *handle, DltLogLevelType loglevel, cons if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK) { - return DLT_RETURN_ERROR; + ret = DLT_RETURN_ERROR; } } @@ -3399,7 +3391,7 @@ DltReturnValue dlt_log_string_int(DltContext *handle, DltLogLevelType loglevel, if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK) { - return DLT_RETURN_ERROR; + ret = DLT_RETURN_ERROR; } } @@ -3428,7 +3420,7 @@ DltReturnValue dlt_log_string_uint(DltContext *handle, DltLogLevelType loglevel, if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK) { - return DLT_RETURN_ERROR; + ret = DLT_RETURN_ERROR; } } @@ -4652,8 +4644,8 @@ DltReturnValue dlt_user_log_check_user_message(void) } else { - dlt_log(LOG_WARNING,"malloc failed!\n"); DLT_SEM_FREE(); + dlt_log(LOG_WARNING,"malloc failed!\n"); return DLT_RETURN_ERROR; } break; diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c index c85af6e..42fcfcb 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage.c +++ b/src/offlinelogstorage/dlt_offline_logstorage.c @@ -198,6 +198,7 @@ DLT_STATIC int dlt_logstorage_list_add(char *key, { free(tmp->key); free(tmp); + tmp->key = NULL; tmp = NULL; return -1; } @@ -207,6 +208,8 @@ DLT_STATIC int dlt_logstorage_list_add(char *key, free(tmp->key); free(tmp->data); free(tmp); + tmp->key = NULL; + tmp->data = NULL; tmp = NULL; return -1; } diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c index cc31ff5..46f0f9e 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c @@ -205,9 +205,8 @@ void dlt_logstorage_rearrange_file_name(DltLogStorageFileList **head) * @param file_config User configurations for log file * @return index on success, -1 if no index is found */ -unsigned int dlt_logstorage_get_idx_of_log_file( - DltLogStorageUserConfig *file_config, - char *file) +unsigned int dlt_logstorage_get_idx_of_log_file(DltLogStorageUserConfig *file_config, + char *file) { unsigned int idx = -1; char *endptr; diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h b/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h index b8c80b2..6ddf21e 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h @@ -1,6 +1,6 @@ /** * @licence app begin@ - * Copyright (C) 2017 Advanced Driver Information Technology. + * Copyright (C) 2018 Advanced Driver Information Technology. * This code is developed by Advanced Driver Information Technology. * Copyright of Advanced Driver Information Technology, Bosch and DENSO. * @@ -12,7 +12,7 @@ * this file, You can obtain one at http://mozilla.org/MPL/2.0/. * * - * \author Aditya Paluri ADIT 2017 + * \author Aditya Paluri ADIT 2018 * * \file: dlt_offline_logstorage_behavior_internal.h * For further information see http://www.genivi.org/. @@ -21,7 +21,7 @@ /******************************************************************************* ** ** -** SRC-MODULE: dlt_offline_logstorage_behavior_internal.h ** +** SRC-MODULE: dlt_offline_logstorage_behavior_internal.h ** ** ** ** TARGET : linux ** ** ** @@ -60,9 +60,8 @@ void dlt_logstorage_sort_file_name(DltLogStorageFileList **head); void dlt_logstorage_rearrange_file_name(DltLogStorageFileList **head); -unsigned int dlt_logstorage_get_idx_of_log_file( - DltLogStorageUserConfig *file_config, - char *file); +unsigned int dlt_logstorage_get_idx_of_log_file(DltLogStorageUserConfig *file_config, + char *file); int dlt_logstorage_storage_dir_info(DltLogStorageUserConfig *file_config, char *path, diff --git a/src/tests/dlt-test-stress-client.c b/src/tests/dlt-test-stress-client.c index d97099b..8a9e2ba 100644 --- a/src/tests/dlt-test-stress-client.c +++ b/src/tests/dlt-test-stress-client.c @@ -163,6 +163,9 @@ int main(int argc, char* argv[]) int c,i; int index; + /* Initialize dltclient */ + memset(&dltclient, 0x0, sizeof(DltClient)); + /* Initialize dltdata */ dltdata.aflag = 0; dltdata.sflag = 0; diff --git a/tests/dlt_test_receiver.c b/tests/dlt_test_receiver.c index e7abd83..555d5da 100644 --- a/tests/dlt_test_receiver.c +++ b/tests/dlt_test_receiver.c @@ -239,7 +239,11 @@ int main(int argc, char* argv[]) { for (index = optind; index < argc; index++) { - dltclient.servIP = argv[index]; + if(dlt_client_set_server_ip(&dltclient, argv[index]) == -1) + { + fprintf(stderr,"set server ip didn't succeed\n"); + return -1; + } } if (dltclient.servIP == 0) @@ -255,7 +259,11 @@ int main(int argc, char* argv[]) { for (index = optind; index < argc; index++) { - dltclient.serialDevice = argv[index]; + if(dlt_client_set_serial_device(&dltclient, argv[index]) == -1) + { + fprintf(stderr,"set serial device didn't succeed\n"); + return -1; + } } if (dltclient.serialDevice == 0) diff --git a/tests/gtest_dlt_daemon_event_handler.cpp b/tests/gtest_dlt_daemon_event_handler.cpp index 235b69e..df9caa0 100644 --- a/tests/gtest_dlt_daemon_event_handler.cpp +++ b/tests/gtest_dlt_daemon_event_handler.cpp @@ -617,11 +617,11 @@ int connectServer(void) portno = 8080; sockfd = socket(AF_INET, SOCK_STREAM, 0); server = gethostbyname("127.0.0.1"); - bzero((char *) &serv_addr, sizeof(serv_addr)); + memset((char *) &serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; - bcopy((char *)server->h_addr, - (char *)&serv_addr.sin_addr.s_addr, - server->h_length); + memcpy((char *)&serv_addr.sin_addr.s_addr, + (char *)server->h_addr, + server->h_length); serv_addr.sin_port = htons(portno); if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) @@ -703,7 +703,7 @@ int main(int argc, char **argv) return -1; } - bzero(buffer, 256); + memset(buffer, 0, 256); (void)(read(newsockfd[i - 1], buffer, 255) + 1); /* just ignore result */ i--; } diff --git a/tests/gtest_dlt_daemon_offline_log.cpp b/tests/gtest_dlt_daemon_offline_log.cpp index dba4136..2563e3d 100644 --- a/tests/gtest_dlt_daemon_offline_log.cpp +++ b/tests/gtest_dlt_daemon_offline_log.cpp @@ -953,7 +953,7 @@ TEST(t_dlt_logstorage_sync_on_msg, normal) TEST(t_dlt_logstorage_sync_on_msg, null) { - EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_sync_on_msg(NULL,NULL,NULL, 0)); + EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_sync_on_msg(NULL, NULL, NULL, 0)); } /* Begin Method: dlt_logstorage::t_dlt_logstorage_prepare_msg_cache*/ @@ -1476,7 +1476,6 @@ TEST(t_dlt_logstorage_find_dlt_header, normal) EXPECT_EQ(2, dlt_logstorage_find_dlt_header(config.cache, 0,sizeof(data))); free(config.cache); } - } TEST(t_dlt_logstorage_find_dlt_header, null) @@ -1527,7 +1526,7 @@ TEST(t_dlt_logstorage_sync_create_new_file, normal) config.cache = calloc(1, 50 + sizeof(DltLogStorageCacheFooter)); if(config.cache != NULL) { - footer = (DltLogStorageCacheFooter *)(config.cache + 50); + footer = (DltLogStorageCacheFooter *)((unsigned char *)config.cache + 50); if (footer != NULL) { EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1)); @@ -1584,7 +1583,6 @@ TEST(t_dlt_logstorage_sync_to_file, normal) EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_sync_to_file(&config, &file_config, path)); free(config.cache); config.cache = NULL; - } } @@ -1632,7 +1630,6 @@ TEST(t_dlt_logstorage_sync_capable_data_to_file, normal) free(config.cache); config.cache = NULL; } - } TEST(t_dlt_logstorage_sync_capable_data_to_file, null) @@ -1643,7 +1640,6 @@ TEST(t_dlt_logstorage_sync_capable_data_to_file, null) /* Begin Method: dlt_logstorage::t_dlt_logstorage_sync_msg_cache*/ TEST(t_dlt_logstorage_sync_msg_cache, normal) { - DltLogStorageUserConfig file_config; memset(&file_config, 0, sizeof(DltLogStorageUserConfig)); file_config.logfile_timestamp =191132; @@ -1681,7 +1677,6 @@ TEST(t_dlt_logstorage_sync_msg_cache, normal) free(config.cache); config.cache = NULL; } - } TEST(t_dlt_logstorage_sync_msg_cache, null) @@ -1699,9 +1694,9 @@ int connectServer(void) server = gethostbyname("127.0.0.1"); bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; - bcopy((char *)server->h_addr, - (char *)&serv_addr.sin_addr.s_addr, - server->h_length); + memcpy((char *)&serv_addr.sin_addr.s_addr, + (char *)server->h_addr, + server->h_length); serv_addr.sin_port = htons(portno); if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) { @@ -1767,7 +1762,7 @@ int main(int argc, char **argv) printf("Error in accept"); return -1; } - bzero(buffer, 256); + memset(buffer, 0, 256); (void)(read(newsockfd[i-1], buffer, 255) + 1); /* just ignore result */ i--; } diff --git a/tests/start_multinode_test.sh b/tests/start_multinode_test.sh index 54a58b5..873964c 100755 --- a/tests/start_multinode_test.sh +++ b/tests/start_multinode_test.sh @@ -143,13 +143,6 @@ cleanup() # setupTest() { - if [ "$OS" = "QNX" ] - then - MESSAGE_FILTER_CONF="/etc/dlt_message_filter.conf" - else - MESSAGE_FILTER_CONF="/etc/dlt_message_filter_ald.conf" - fi - which dlt-daemon > /dev/null if [ $? -ne '0' ] then @@ -199,7 +192,6 @@ setupTest() echo "RingbufferStepSize = 500000" >>$tmpPath/$tmpFolder/$gatewayFolderName/dlt.conf echo "ControlSocketPath = /tmp/dlt-ctrl.sock" >>$tmpPath/$tmpFolder/$gatewayFolderName/dlt.conf echo "GatewayConfigFile = $tmpPath/$tmpFolder/$gatewayFolderName/dlt_gateway.conf" >> $tmpPath/$tmpFolder/$gatewayFolderName/dlt.conf - echo "MessageFilterConfigFile = $MESSAGE_FILTER_CONF" >> $tmpPath/$tmpFolder/$gatewayFolderName/dlt.conf touch $tmpPath/$tmpFolder/$gatewayFolderName/dlt_gateway.conf if [ $? -ne '0' ] then @@ -236,7 +228,6 @@ setupTest() echo "RingbufferMaxSize = 10000000" >>$tmpPath/$tmpFolder/$passiveFolderName/dlt.conf echo "RingbufferStepSize = 500000" >>$tmpPath/$tmpFolder/$passiveFolderName/dlt.conf echo "ControlSocketPath = /tmp/dlt-ctrl.sock" >>$tmpPath/$tmpFolder/$passiveFolderName/dlt.conf - echo "MessageFilterConfigFile = $MESSAGE_FILTER_CONF" >> $tmpPath/$tmpFolder/$passiveFolderName/dlt.conf mkdir -p $tmpPath/$tmpFolder/$tmpPassiveDIR if [ $? -ne '0' ] then -- cgit v1.2.1