summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLe-Tin <Tin.Le@vn.bosch.com>2021-09-01 10:54:43 +0000
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2021-10-05 11:07:38 +0900
commitb942cb8c5c565fe1d56711607018bd36ada74f16 (patch)
tree3ea1d47e598fafab5ec64e9e67e33535c50b40aa
parentf16953f5ab2506ef0fb714fe6bb8a022845b8c68 (diff)
downloadDLT-daemon-b942cb8c5c565fe1d56711607018bd36ada74f16.tar.gz
gtest_dlt_daemon_gateway: fix gtest build failed
Add gtest and gtest_main libraries if we don't install gtest package in system Create a new message fillter config file when running gtest gateway shell script set type of control message is CONTROL_MESSAGE_ON_DEMAND when testing dlt_gateway_send_control_message function Signed-off-by: Le-Tin <Tin.Le@vn.bosch.com>
-rw-r--r--tests/CMakeLists.txt14
-rw-r--r--tests/gtest_dlt_daemon_gateway.cpp1
-rwxr-xr-xtests/gtest_dlt_daemon_gateway.sh8
3 files changed, 15 insertions, 8 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ccf6e03..a461891 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -8,8 +8,12 @@ configure_file(${PROJECT_SOURCE_DIR}/tests/testfile.dlt ${PROJECT_BINARY_DIR}/te
configure_file(${PROJECT_SOURCE_DIR}/tests/testfilter.txt ${PROJECT_BINARY_DIR}/tests COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/tests/testfile_filetransfer.txt ${PROJECT_BINARY_DIR}/tests COPYONLY)
-set(GTEST_LIBS gtest gtest_main)
-set(GTEST_LIBS ${GTEST_LIBS} CACHE STRING "Gtest libraries")
+if("${GTEST_BOTH_LIBRARIES}" STREQUAL "")
+ set(GTEST_LIBS gtest gtest_main)
+ set(GTEST_LIBS ${GTEST_LIBS} CACHE STRING "Gtest libraries")
+else()
+ set(GTEST_LIBS ${GTEST_BOTH_LIBRARIES})
+endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LIBRARIES "")
@@ -17,9 +21,9 @@ else()
set(LIBRARIES socket)
endif()
-set(DLT_LIBRARIES dlt ${GTEST_BOTH_LIBRARIES} ${LIBRARIES})
-set(DLT_DAEMON_LIBRARIES dlt_daemon ${GTEST_BOTH_LIBRARIES} ${LIBRARIES})
-set(DLT_CONTROL_LIBRARIES dlt dlt_control_common_lib ${GTEST_BOTH_LIBRARIES})
+set(DLT_LIBRARIES dlt ${GTEST_LIBS} ${LIBRARIES})
+set(DLT_DAEMON_LIBRARIES dlt_daemon ${GTEST_LIBS} ${LIBRARIES})
+set(DLT_CONTROL_LIBRARIES dlt dlt_control_common_lib ${GTEST_LIBS})
#Receiver used for QTs. add_test() is not required
add_executable(dlt_test_receiver dlt_test_receiver.c)
diff --git a/tests/gtest_dlt_daemon_gateway.cpp b/tests/gtest_dlt_daemon_gateway.cpp
index 5bdefac..418ed86 100644
--- a/tests/gtest_dlt_daemon_gateway.cpp
+++ b/tests/gtest_dlt_daemon_gateway.cpp
@@ -121,6 +121,7 @@ TEST(t_dlt_gateway_send_control_message, Normal)
(void) dlt_gateway_init(&daemon_local, 0);
daemon_local.pGateway.connections->p_control_msgs->id = DLT_SERVICE_ID_GET_LOG_INFO;
+ daemon_local.pGateway.connections->p_control_msgs->type = CONTROL_MESSAGE_ON_DEMAND;
EXPECT_EQ(DLT_RETURN_OK, dlt_gateway_send_control_message(daemon_local.pGateway.connections,
daemon_local.pGateway.connections->p_control_msgs,
NULL, 0));
diff --git a/tests/gtest_dlt_daemon_gateway.sh b/tests/gtest_dlt_daemon_gateway.sh
index 5b7951d..5a357b3 100755
--- a/tests/gtest_dlt_daemon_gateway.sh
+++ b/tests/gtest_dlt_daemon_gateway.sh
@@ -169,8 +169,10 @@ setupTest()
echo "SendControl=0x03,0x13" >>$tmpPath/dlt_gateway.conf
echo "SendSerialHeader=0" >>$tmpPath/dlt_gateway.conf
echo "NOFiles=1" >>$tmpPath/dlt_gateway.conf
+
return 0
}
+
#
# Function: -startDaemons()
#
@@ -184,7 +186,7 @@ startDaemons()
{
DLT_PASSIVE_SHM_NAME=""
tmpPath=/tmp
- dlt-daemon -d
+ dlt-daemon -c $tmpPath/dlt_passive.conf &
sleep 1
# Check if the dlt shm file exist (DLT_SHM_ENABLE=ON)
@@ -192,7 +194,7 @@ startDaemons()
DLT_PASSIVE_SHM_NAME="-s dlt-shm-passive"
fi
- dlt-daemon -d -p 3495 -c $tmpPath/dlt.conf $DLT_PASSIVE_SHM_NAME
+ dlt-daemon -p 3495 -c $tmpPath/dlt.conf $DLT_PASSIVE_SHM_NAME &
return 0
}
@@ -212,7 +214,7 @@ checkDaemonStart()
if [ $total -ne '2' ]; then
echo "Initialization of dlt-daemon instances failed"
- exit
+ exit 1
fi
}