1#!/bin/bash 2# Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 3# This Source Code Form is subject to the terms of the Mozilla Public 4# License, v. 2.0. If a copy of the MPL was not distributed with this 5# file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7# Purpose: This script is needed to start the client and service with 8# one command. This is necessary as ctest - which is used to run the 9# tests - isn't able to start two binaries for one testcase. Therefore 10# the testcase simply executes this script. This script then runs client 11# and service and checks that both exit successfully. 12 13# Display a message to show the user that he must now call the external service 14# to finish the test successfully 15 16FAIL=0 17 18if [ ! -z "$USE_LXC_TEST" ]; then 19 echo "starting magic cookies test on slave LXC" 20 ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip_lib/test; ./magic_cookies_test_client_start.sh\"" & 21elif [ ! -z "$USE_DOCKER" ]; then 22 docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./magic_cookies_test_client_start.sh" & 23elif [ ! -z "$JENKINS" ]; then 24 ssh -tt -i $PRV_KEY -o StrictHostKeyChecking=no jenkins@$IP_SLAVE "bash -ci \"set -m; cd $WS_ROOT/build/test; ./magic_cookies_test_client_start.sh\" >> $WS_ROOT/slave_test_output 2>&1" & 25 26else 27cat <<End-of-message 28******************************************************************************* 29******************************************************************************* 30** Please now run: 31** magic_cookies_test_client_start.sh 32** from an external host to successfully complete this test. 33** 34** You probably will need to adapt the 'unicast' settings in 35** magic_cookies_client.json and 36** magic_cookies_service.json to your personal setup. 37** 38******************************************************************************* 39******************************************************************************* 40End-of-message 41fi 42 43# Start the client for magic-cookies test 44export VSOMEIP_APPLICATION_NAME=magic_cookies_test_service 45export VSOMEIP_CONFIGURATION=magic_cookies_test_service.json 46./magic_cookies_test_service --tcp --static-routing & 47 48# Wait until client and service are finished 49for job in $(jobs -p) 50do 51 # Fail gets incremented if either client or service exit 52 # with a non-zero exit code 53 wait $job || ((FAIL+=1)) 54done 55 56# Check if client and server both exited successfully 57if [ $FAIL -eq 0 ] 58then 59 exit 0 60else 61 exit 1 62fi 63