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 sucessfully.
12
13# Start the service
14export VSOMEIP_APPLICATION_NAME=header_factory_test_service
15export VSOMEIP_CONFIGURATION=header_factory_test_service.json
16./header_factory_test_service &
17sleep 1;
18
19# Start the client
20export VSOMEIP_APPLICATION_NAME=header_factory_test_client
21export VSOMEIP_CONFIGURATION=header_factory_test_client.json
22./header_factory_test_client &
23
24# Wait until client and service are finished
25FAIL=0
26for job in $(jobs -p)
27do
28    # Fail gets incremented if either client or service exit
29    # with a non-zero exit code
30    wait $job || ((FAIL+=1))
31done
32
33# Check if client and server both exited sucessfully
34if [ $FAIL -eq 0 ]
35then
36    exit 0
37else
38    exit 1
39fi
40