xref: /openbmc/openbmc-build-scripts/scripts/run-robot.sh (revision 384d741b9e04fce8d6a56e56ff4eeeac195570a9)
1#!/bin/bash -x
2# Extract and run the OpenBMC robot test suite
3#
4# The robot test results will be copied to ${HOME}
5#
6#  Requires following env variables be set:
7#   IP_ADDR     IP Address of openbmc
8#   SSH_PORT    SSH port of openbmc
9#   HTTPS_PORT  HTTPS port of openbmc
10#
11#  Optional env variable
12#   ROBOT_CODE_HOME  Location to extract the code
13#                    Default will be a temp location in /tmp/
14#   ROBOT_TEST_CMD   Command to execute from within obmc robot test framework
15#                    Default will be "tox -e qemu -- --include QEMU_CI tests"
16#   MACHINE          Type of system to run tests against
17#                    Default is qemu
18
19# we don't want to fail on bad rc since robot tests may fail
20
21set -e
22
23MACHINE=${MACHINE:-"qemu"}
24ROBOT_CODE_HOME=${ROBOT_CODE_HOME:-/tmp/$(whoami)/${RANDOM}/obmc-robot/}
25ROBOT_TEST_CMD=${ROBOT_TEST_CMD:-"python3 -m robot\
26    -v OPENBMC_HOST:${IP_ADDR}\
27    -v SSH_PORT:${SSH_PORT}\
28    -v HTTPS_PORT:${HTTPS_PORT}\
29    --argumentfile ./test_lists/QEMU_CI ./tests"}
30
31git clone https://github.com/openbmc/openbmc-test-automation.git \
32        "${ROBOT_CODE_HOME}"
33
34cd "${ROBOT_CODE_HOME}"
35
36chmod ugo+rw -R "${ROBOT_CODE_HOME}"/*
37
38# Execute the CI tests
39# shellcheck disable=SC2091 # intentionally executing ROBOT_TEST_CMD.
40$($ROBOT_TEST_CMD)
41
42cp "${ROBOT_CODE_HOME}"/*.xml "${HOME}/"
43cp "${ROBOT_CODE_HOME}"/*.html "${HOME}/"
44if [ -d logs ] ; then
45    cp -Rf "${ROBOT_CODE_HOME}"/logs "${HOME}"/ ;
46fi
47
48#rm -rf ${ROBOT_CODE_HOME}
49