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 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 1 ] 14then 15 echo "Please pass a json file to this script." 16 echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_slave.json" 17 echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter" 18 exit 1 19fi 20 21RELIABILITY_TYPE=$1 22SLAVE_JSON_FILE=$2 23SAME_SERVICE_ID=$3 24 25FAIL=0 26# Start the services 27export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_four 28export VSOMEIP_CONFIGURATION=$SLAVE_JSON_FILE 29./subscribe_notify_test_service 4 $RELIABILITY_TYPE $3 & 30 31export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_five 32export VSOMEIP_CONFIGURATION=$SLAVE_JSON_FILE 33./subscribe_notify_test_service 5 $RELIABILITY_TYPE $3 & 34 35export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_six 36export VSOMEIP_CONFIGURATION=$SLAVE_JSON_FILE 37./subscribe_notify_test_service 6 $RELIABILITY_TYPE $3 & 38 39sleep 3 40 41# Wait until all applications are finished 42for job in $(jobs -p) 43do 44 # Fail gets incremented if one of the binaries exits 45 # with a non-zero exit code 46 wait $job || ((FAIL+=1)) 47done 48 49# Check if both exited successfully 50if [ $FAIL -eq 0 ] 51then 52 exit 0 53else 54 exit 1 55fi 56