1#!/bin/bash 2# Copyright (C) 2015-2018 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 services with 8# one command. This is necessary as ctest - which is used to run the 9# tests - isn't able to start multiple binaries for one testcase. Therefore 10# the testcase simply executes this script. This script then runs the services 11# and checks that all exit successfully. 12 13if [ $# -lt 2 ] 14then 15 echo "Please pass a json file to this script and wether remote clients are allowed or not " 16 echo "For example: $0 security_test_config_service_external_allow.json --allow" 17 exit 1 18fi 19 20CLIENT_JSON_FILE=$1 21ALLOW_DENY=$2 22 23FAIL=0 24 25export VSOMEIP_CONFIGURATION=$1 26export VSOMEIP_APPLICATION_NAME=routingmanagerd 27# start daemon 28../examples/routingmanagerd/./routingmanagerd & 29PID_VSOMEIPD=$! 30 31export VSOMEIP_CONFIGURATION=$1 32export VSOMEIP_APPLICATION_NAME=service-sample 33./security_test_service --remote $2 & 34PID_SERVICE=$! 35 36# Wait until client and service are finished 37for client_pid in "${PID_SERVICE}" 38do 39 if [ -n "$client_pid" ]; then 40 # Fail gets incremented if either client or service exit 41 # with a non-zero exit code 42 wait "$client_pid" || ((FAIL+=1)) 43 fi 44done 45 46kill $PID_VSOMEIPD 47kill $PID_SERVICE 48 49# Check if both exited successfully 50if [ $FAIL -eq 0 ] 51then 52 exit 0 53else 54 exit 1 55fi 56