blob: 64f36e752e72b8b421ae929eb9caa5effc5f1e33 [file] [log] [blame]
Jerry Floodba3b3292017-04-09 11:25:24 -04001#!/bin/bash
2INSTALL_DIR=/var/opt/OpenECOMP_ETE
3
4#####################################################################
5# Start display on 256 if it has not already been started...
6# This will stay up and be used for all soak tests
7# Tried this once and got an unexpected error so restored the start/kill
8# pattern for each test for now.
9# Perhaps the error was unrelated to the using the same display for
10# all tests. Preserve this just in case....
11function start_display_if
12{
13 export DISPLAY=:256
14 xdpyinfo -display $DISPLAY >/dev/null 2>&1
15 while [ $? = 1 ]
16 do
17 # Start Xvfb
18 echo -e "Starting Xvfb on display ${DISPLAY} with res ${RES}"
19 Xvfb ${DISPLAY} -ac -screen 0 ${RES} +extension RANDR &
20 disown
21 done
22}
23
24#####################################################################
25function start_display
26{
27 export DISPLAY=:$(( $TEST_NUMBER % 256 ))
28 xdpyinfo -display $DISPLAY >/dev/null 2>&1
29 while [ $? = 0 ]
30 do
31 DISPLAY=$(( $RANDOM % 1000 ))
32 xdpyinfo -display $DISPLAY >/dev/null 2>&1
33 done
34 # Start Xvfb
35 echo -e "Starting Xvfb on display ${DISPLAY} with res ${RES}"
36 Xvfb ${DISPLAY} -ac -screen 0 ${RES} +extension RANDR &
37 XVFBPID=$!
38 disown
39 echo ${DISPLAY} > /tmp/robotDisplay.$TEST_NUMBER
40 # Get and save pid of this spawned process to make sure we kill the correct process later
41}
42
43#####################################################################
44function kill_display
45{
46 xdpyinfo -display $DISPLAY >/dev/null 2>&1
47 if [ $? = 0 ]; then
48 kill -9 $XVFBPID >/dev/null 2>&1
49 fi
50 rm -rf /tmp/robotDisplay.$TEST_NUMBER
51}
52
53#####################################################################
54# main
55#####################################################################
56export ROBOT_TAG=$1
57export TEST_NUMBER=$2
58
59if [ "$TEST_NUMBER" = "" ];then
60 TEST_NUMBER=$$
61fi
62
63# Use default if none specified as env var
64DEFAULT_LOG_LEVEL="INFO" # Available levels: TRACE, DEBUG, INFO (default), WARN, NONE (no logging)
65LOG_LEVEL=${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}
66
67# To mitigate the chromedriver hanging issue
68export DBUS_SESSION_BUS_ADDRESS=/dev/null
69
70RES="1280x1024x24"
71OUTPUT_FOLDER=/share/logs/${SOAKSUBFOLDER}runEteTag_$TEST_NUMBER
72mkdir -p $OUTPUT_FOLDER
73INSTALL_DIR="/var/opt/OpenECOMP_ETE"
74
75ROBOT_LIBS=./robot/library:./robot/library/eteutils:./robot/library/heatbridge
76VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
77VARIABLES="-v GLOBAL_BUILD_NUMBER:$TEST_NUMBER"
78LISTENERS=
79
80start_display
81
82# Execute tests
83echo -e "Executing robot test ${ROBOT_TAG} at log level ${LOG_LEVEL}"
84
85cd ${INSTALL_DIR}
86python -m robot.run -L ${LOG_LEVEL} -d ${OUTPUT_FOLDER} ${VARIABLEFILES} ${VARIABLES} ${LISTENERS} -P ${ROBOT_LIBS} -i ${ROBOT_TAG} $(pwd) > ${OUTPUT_FOLDER}/robot.out 2>&1
87
88####################################################################
89# Stop Xvfb we started earlier
90kill_display