• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7FAIL=0
8
9if [ $# -lt 2 ]
10then
11    echo "Please pass a operation and communication mode to this script."
12    echo "For example: $0 PAYLOAD_FIXED UDP"
13    echo "Valid operation modes include [PAYLOAD_FIXED, PAYLOAD_DYNAMIC]"
14    echo "Valid communication modes include [UDP, TCP]"
15    exit 1
16fi
17TESTMODE=$1
18COMMUNICATIONMODE=$2
19
20export VSOMEIP_CONFIGURATION=event_test_master.json
21../examples/routingmanagerd/./routingmanagerd &
22PID_VSOMEIPD=$!
23
24./event_test_client $TESTMODE $COMMUNICATIONMODE &
25PID_CLIENT=$!
26
27sleep 1
28
29if [ ! -z "$USE_LXC_TEST" ]; then
30    echo "starting offer test on slave LXC offer_test_external_slave_starter.sh"
31    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; ./event_test_slave_starter.sh $COMMUNICATIONMODE\"" &
32elif [ ! -z "$USE_DOCKER" ]; then
33    docker exec $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && sleep 10; ./event_test_slave_starter.sh $COMMUNICATIONMODE" &
34elif [ ! -z "$JENKINS" ]; then
35    ssh -tt -i $PRV_KEY -o StrictHostKeyChecking=no jenkins@$IP_SLAVE "bash -ci \"set -m; cd $WS_ROOT/build/test; ./event_test_slave_starter.sh $COMMUNICATIONMODE\" >> $WS_ROOT/slave_test_output 2>&1" &
36
37else
38cat <<End-of-message
39*******************************************************************************
40*******************************************************************************
41** Please now run:
42** event_test_slave_starter.sh $COMMUNICATIONMODE
43** from an external host to successfully complete this test.
44**
45** You probably will need to adapt the 'unicast' settings in
46** event_test_slave_{udp,tcp}.json to your personal setup.
47*******************************************************************************
48*******************************************************************************
49End-of-message
50fi
51
52# Wait until all clients and services are finished
53for job in $PID_CLIENT
54do
55    # Fail gets incremented if a client exits with a non-zero exit code
56    echo "waiting for $job"
57    wait $job || FAIL=$(($FAIL+1))
58done
59
60kill $PID_VSOMEIPD
61sleep 1
62
63# Check if everything went well
64exit $FAIL
65