QGIS/.ci/travis/linux/scripts/docker-qgis-test.sh

136 lines
4.1 KiB
Bash
Raw Normal View History

2019-03-07 13:08:35 +01:00
#!/usr/bin/env bash
set -e
# Temporarily uncomment to debug ccache issues
# echo "travis_fold:start:ccache-debug"
# cat /tmp/cache.debug
# echo "travis_fold:end:ccache-debug"
##################################
# Prepare HANA database connection
##################################
if [ ${HANA_TESTS} == "true" ] ; then
echo "travis_fold:start:hana"
echo "${bold}Load HANA database...${endbold}"
export QGIS_HANA_TEST_DB='driver='/usr/sap/hdbclient/libodbcHDB.so' host='${HANA_HOST}' port='${HANA_PORT}' user='${HANA_USER}' password='${HANA_PASSWORD}' sslEnabled=true sslValidateCertificate=False'
# wait for the DB to be available
echo "Wait a moment while trying to connect to a HANA database."
while ! echo exit | hdbsql -n '${HANA_HOST}:${HANA_PORT}' -u '${HANA_USER}' -p '${HANA_PASSWORD}' &> /dev/null
do
2021-01-21 14:00:35 +01:00
printf "⚘"
sleep 1
done
2021-01-21 14:00:35 +01:00
echo "🌊 done"
echo "travis_fold:end:hana"
fi
2019-03-07 13:08:35 +01:00
############################
# Restore postgres test data
############################
echo "travis_fold:start:postgres"
echo "${bold}Load Postgres database...🐘${endbold}"
2019-03-07 13:08:35 +01:00
printf "[qgis_test]\nhost=postgres\nport=5432\ndbname=qgis_test\nuser=docker\npassword=docker" > ~/.pg_service.conf
export PGUSER=docker
export PGHOST=postgres
export PGPASSWORD=docker
export PGDATABASE=qgis_test
2019-03-08 12:39:32 +01:00
# wait for the DB to be available
echo "Wait a moment while loading PostGreSQL database."
2019-03-08 12:39:32 +01:00
while ! PGPASSWORD='docker' psql -h postgres -U docker -p 5432 -l &> /dev/null
do
printf "🐘"
sleep 1
done
echo " done 🥩"
2019-03-07 13:08:35 +01:00
pushd /root/QGIS > /dev/null
echo "Restoring postgres test data ..."
2019-03-07 13:08:35 +01:00
/root/QGIS/tests/testdata/provider/testdata_pg.sh
echo "Postgres test data restored ..."
2019-03-07 13:08:35 +01:00
popd > /dev/null # /root/QGIS
echo "travis_fold:end:postgres"
2019-03-07 13:08:35 +01:00
##############################
# Restore Oracle test data
##############################
echo "travis_fold:start:oracle"
echo "${bold}Load Oracle database...🙏${endbold}"
export ORACLE_HOST="oracle"
export QGIS_ORACLETEST_DBNAME="${ORACLE_HOST}/XEPDB1"
export QGIS_ORACLETEST_DB="host=${QGIS_ORACLETEST_DBNAME} port=1521 user='QGIS' password='qgis'"
echo "Wait a moment while loading Oracle database."
while ! echo exit | sqlplus -L SYSTEM/adminpass@$QGIS_ORACLETEST_DBNAME &> /dev/null
do
printf "🙏"
sleep 1
done
echo " done 👀"
pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_oracle.sh $ORACLE_HOST
popd > /dev/null # /root/QGIS
echo "travis_fold:end:oracle"
2019-09-13 10:02:34 +10:00
# this is proving very flaky:
2019-03-07 13:08:35 +01:00
##############################
# Restore SQL Server test data
##############################
2019-09-13 10:02:34 +10:00
# echo "Importing SQL Server test data..."
2019-03-07 13:08:35 +01:00
2019-09-13 10:02:34 +10:00
# export SQLUSER=sa
# export SQLHOST=mssql
# export SQLPORT=1433
# export SQLPASSWORD='<YourStrong!Passw0rd>'
# export SQLDATABASE=qgis_test
2019-03-07 13:08:35 +01:00
2019-09-13 10:02:34 +10:00
# export PATH=$PATH:/opt/mssql-tools/bin
2019-03-07 13:08:35 +01:00
2019-09-13 10:02:34 +10:00
# pushd /root/QGIS > /dev/null
# /root/QGIS/tests/testdata/provider/testdata_mssql.sh
# popd > /dev/null # /root/QGIS
2019-03-07 13:08:35 +01:00
2019-09-13 10:02:34 +10:00
# echo "Setting up DSN for test SQL Server"
2019-03-07 13:08:35 +01:00
2019-09-13 10:02:34 +10:00
# cat <<EOT > /etc/odbc.ini
# [ODBC Data Sources]
# testsqlserver = ODBC Driver 17 for SQL Server
2019-03-07 13:08:35 +01:00
2019-09-13 10:02:34 +10:00
# [testsqlserver]
# Driver = ODBC Driver 17 for SQL Server
# Description = Test SQL Server
# Server = mssql
# EOT
2019-03-07 13:08:35 +01:00
###########
# Run tests
###########
CURRENT_TIME=$(date +%s)
2019-03-07 19:37:07 +01:00
TIMEOUT=$((( TRAVIS_AVAILABLE_TIME - TRAVIS_UPLOAD_TIME) * 60 - CURRENT_TIME + TRAVIS_TIMESTAMP))
echo "Timeout: ${TIMEOUT}s (started at ${TRAVIS_TIMESTAMP}, current: ${CURRENT_TIME})"
EXCLUDE_TESTS=$(cat /root/QGIS/.ci/travis/linux/scripts/test_blocklist.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)
if ! [[ ${RUN_FLAKY_TESTS} =~ ^true$ ]]; then
echo "Flaky tests are skipped!"
EXCLUDE_TESTS=${EXCLUDE_TESTS}"|"$(cat /root/QGIS/.ci/travis/linux/scripts/test_flaky.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)
else
echo "Flaky tests are run!"
fi
echo "List of skipped tests: $EXCLUDE_TESTS"
timeout ${TIMEOUT}s python3 /root/QGIS/.ci/travis/scripts/ctest2travis.py xvfb-run ctest -V -E "${EXCLUDE_TESTS}" -S /root/QGIS/.ci/travis/travis.ctest --output-on-failure
2019-03-07 13:08:35 +01:00
rv=$?
if [ $rv -eq 124 ] ; then
printf '\n\n${bold}Build and test timeout. Please restart the build for meaningful results.${endbold}\n'
exit #$rv
fi