From 45a9314989ecd5c07d37364f3d7d09b19d1e33f6 Mon Sep 17 00:00:00 2001 From: "S. Hameed" Date: Mon, 29 Aug 2016 17:28:19 +0900 Subject: Unit Test: Multinode Unit test preparation script Signed-off-by: S. Hameed Signed-off-by: Christoph Lipka --- tests/g_test_dlt_daemon_gateway.sh | 137 +++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100755 tests/g_test_dlt_daemon_gateway.sh (limited to 'tests') diff --git a/tests/g_test_dlt_daemon_gateway.sh b/tests/g_test_dlt_daemon_gateway.sh new file mode 100755 index 0000000..bb76a6b --- /dev/null +++ b/tests/g_test_dlt_daemon_gateway.sh @@ -0,0 +1,137 @@ +#!/bin/sh +################################################################################ +# @licence make begin@ +# SPDX license identifier: MPL-2.0 +# +# Copyright (C) 2016, Advanced Driver Information Technology +# This code is developed by Advanced Driver Information Technology. +# Copyright of Advanced Driver Information Technology, Bosch and DENSO. +# +# This file is part of GENIVI Project DLT - Diagnostic Log and Trace. +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License (MPL), v. 2.0. +# If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# For further information see http://www.genivi.org/. +# @licence end@ +################################################################################ + +################################################################################ +#file : g_test_dlt_daemon_gateway.sh +# +#Description : gateway unit test preparation +# +#Author Name : Onkar Palkar +#Email Id : onkar.palkar@wipro.com +# +#History : Last modified date : 29/07/2016 +################################################################################ +# +# Function: -cleanup() +# +# Description -Delete the dlt_test folder if it already present +# -Check weather required binaries are avaiable or not +# -Restore dlt_gateway.conf file +# +# Return -Zero on success +# -Non zero on failure +# +ipaddr=127.0.0.1 + +cleanup() +{ + tmpPath=/tmp + cd $tmpPath + pidof dlt-daemon > /dev/null + if [ $? -eq '0' ] + then + killall dlt-daemon + if [ $? -eq '1' ] + then + echo "Failed to kill daemons" + return 1 + fi + fi + return 0 + + rm $tmpPath/dlt.conf +} +# +# Function: -setupTest() +# +# Description -Create gateway folder +# -Create and add dlt.conf and dlt_gateway.conf file in the gateway folder +# +# Return -Zero on success +# -Non zero on failure +# +setupTest() +{ + which dlt-daemon > /dev/null + if [ $? -eq '1' ] + then + echo "dlt-daemon is not available" + return 1 + fi + touch $tmpPath/dlt.conf + if [ $? -eq '1' ] + then + echo "Error in creating dlt.conf file" + return 1 + fi + echo "SendContextRegistration = 1" >>$tmpPath/dlt.conf + echo "ECUId = ECU1" >>$tmpPath/dlt.conf + echo "GatewayMode = 1" >>$tmpPath/dlt.conf + echo "SharedMemorySize = 100000" >>$tmpPath/dlt.conf + echo "LoggingMode = 0" >>$tmpPath/dlt.conf + echo "LoggingLevel = 6" >>$tmpPath/dlt.conf + echo "LoggingFilename = /tmp/dlt.log" >>$tmpPath/dlt.conf + echo "TimeOutOnSend = 4" >>$tmpPath/dlt.conf + echo "RingbufferMinSize = 500000" >>$tmpPath/dlt.conf + echo "RingbufferMaxSize = 10000000" >>$tmpPath/dlt.conf + echo "RingbufferStepSize = 500000" >>$tmpPath/dlt.conf + echo "ControlSocketPath = /tmp/dlt-ctrl.sock" >>$tmpPath/dlt.conf + echo "GatewayConfigFile = /tmp/$tmpFolder/dlt_gateway.conf" >>$tmpPath/dlt.conf + touch $tmpPath/dlt_gateway.conf + if [ $? -eq '1' ] + then + echo "Error in creating dlt_gateway file" + return 1 + fi + echo "[PassiveNode1]" >>$tmpPath/dlt_gateway.conf + echo "IPaddress=$ipaddr">>$tmpPath/dlt_gateway.conf + echo "Port=3495" >>$tmpPath/dlt_gateway.conf + echo "EcuID=ECU1" >>$tmpPath/dlt_gateway.conf + echo "Connect=OnStartup" >>$tmpPath/dlt_gateway.conf + echo "Timeout=10" >>$tmpPath/dlt_gateway.conf + echo "NOFiles=1" >>$tmpPath/dlt_gateway.conf + return 0 +} +# +# Function: -startDaemons() +# +# Description -Start dlt-daemon as passive node +# +# Return -Zero on success +# -Non zero on failure +# +startDaemons() +{ + dlt-daemon -p 3495 + return 0 +} +#main function +######################################################################################## +cleanup +if [ $? -ne '0' ] +then +return 1 +fi +setupTest +if [ $? -ne '0' ] +then +return 1 +fi +startDaemons -- cgit v1.2.1