Files
MaxScale/maxscale-system-test/mdbci/run_test.sh
Timofey Turenko cd732ac14f MXS-2243 System tests brings VMs by themselves (#193)
maxscale-system-test changed in order to control test environment by itself.
Every test checks which machines are running, compare with list of needed machines
and start new VMs is they are missing in the running machines list.
Tests are executiong MDBCI commands, MDBCI executable should be in the PATH
2019-04-02 13:27:34 +03:00

93 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# see set_run_test_variables.sh for default values of all variables
# $box - Name of Vagrant box for Maxscale machine
# see lists of supported boxes
# https://github.com/mariadb-corporation/mdbci/tree/integration/BOXES
# $template - name of MDBCI json template file
# Template file have to be in ./templates/, file name
# have to be '$template.json.template
# Template file can contain references to any variables -
# all ${variable_name} will be replaced with values
# $name - name of test run. It can be any string of leytters or digits
# If it is not defined, name will be automatically genereted
# using $box and current date and time
# $product - 'mariadb' or 'mysql'
# $version - version of backend DB (e.g. '10.1', '10.2')
# $galera_version - version of Galera backend DB
# same as $version by default
# $target - name of binary repository
# (name of subdirectroy http://max-tst-01.mariadb.com/ci-repository/)
# $team_keys - path to the file with open ssh keys to be
# installed on all VMs (default ${HOME}/team_keys)
# $do_not_destroy_vm - if 'yes' VM won't be destored afther the test
# $test_set - parameters to be send to 'ctest' (e.g. '-I 1,100',
# '-LE UNSTABLE'
# if $test_set starts from 'NAME#' ctest will not be executed,
# the value of $test_set after 'NAME#' is used as bash command
# line
# example: '#NAME long_test_time=3600 ./long_test'
export vm_memory=${vm_memory:-"2048"}
export dir=`pwd`
ulimit -n
# read the name of build scripts directory
export script_dir="$(dirname $(readlink -f $0))"
. ${script_dir}/set_run_test_variables.sh
rm -rf LOGS
export target=`echo $target | sed "s/?//g"`
export mdbci_config_name=`echo ${mdbci_config_name} | sed "s/?//g"`
export provider=`mdbci show provider $box --silent 2> /dev/null`
export backend_box=${backend_box:-"centos_7_"$provider}
mdbci destroy ${mdbci_config_name}
. ${script_dir}/configure_log_dir.sh
ulimit -c unlimited
cd ${script_dir}/../../
mkdir build && cd build
cmake .. -DBUILD_SYSTEM_TESTS=Y -DBUILDNAME=${mdbci_config_name} -DCMAKE_BUILD_TYPE=Debug
cd maxscale-system-test
make
echo ${test_set} | grep "NAME#"
if [ $? == 0 ] ; then
named_test=`echo ${test_set} | sed "s/NAME#//"`
echo ${named_test} | grep "\./"
if [ $? != 0 ] ; then
named_test="./"${named_test}
fi
fi
if [ ! -z "${named_test}" ] ; then
eval ${named_test}
else
ctest -VV ${test_set}
fi
cp core.* ${logs_publish_dir}
${script_dir}/copy_logs.sh
cd $dir
if [ "${do_not_destroy_vm}" != "yes" ] ; then
mdbci destroy ${mdbci_config_name}
echo "clean up done!"
fi