QGIS/.ci/travis/linux/docker-build-test.sh

95 lines
2.7 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2017-09-21 09:07:37 +02:00
set -e
2019-03-06 15:26:20 +01:00
##############################
# Run Python Tests on QGIS app
##############################
# Passing cases:
echo "QGIS tests runner"
pushd /root/qgis_test_runner
./qgis_testrunner.sh test_testrunner.run_passing && echo "1/5 succeeded" || exit 1
./qgis_testrunner.sh test_testrunner.run_skipped_and_passing && echo "2/5 succeeded" || exit 1
# Failing cases:
./qgis_testrunner.sh test_testrunner && exit 1 || echo "3/5 succeeded"
./qgis_testrunner.sh test_testrunner.run_all && exit 1 || echo "5/5 succeeded"
./qgis_testrunner.sh test_testrunner.run_failing && exit 1 || echo "5/5 succeeded"
popd
2017-10-29 09:51:51 +01:00
# Temporarily uncomment to debug ccache issues
# echo "travis_fold:start:ccache-debug"
# cat /tmp/cache.debug
# echo "travis_fold:end:ccache-debug"
2017-09-21 09:07:37 +02:00
############################
# Restore postgres test data
2017-09-21 09:07:37 +02: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
2017-10-07 09:42:05 +02:00
pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_pg.sh
2017-10-07 09:42:05 +02:00
popd > /dev/null # /root/QGIS
2018-10-09 09:01:50 +10:00
##############################
# Restore SQL Server test data
##############################
echo "Importing SQL Server test data..."
export SQLUSER=sa
export SQLHOST=mssql
export SQLPORT=1433
export SQLPASSWORD='<YourStrong!Passw0rd>'
export SQLDATABASE=qgis_test
export PATH=$PATH:/opt/mssql-tools/bin
pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_mssql.sh
popd > /dev/null # /root/QGIS
echo "Setting up DSN for test SQL Server"
cat <<EOT > /etc/odbc.ini
[ODBC Data Sources]
testsqlserver = ODBC Driver 17 for SQL Server
[testsqlserver]
Driver = ODBC Driver 17 for SQL Server
Description = Test SQL Server
Server = mssql
EOT
2017-09-21 09:07:37 +02:00
###########
# Run tests
###########
CURRENT_TIME=$(date +%s)
TIMEOUT=$((( TRAVIS_TIME - UPLOAD_TIME) * 60 - CURRENT_TIME + TRAVIS_TIMESTAMP))
2018-04-04 12:19:03 -04:00
echo "Timeout: ${TIMEOUT}s (started at ${TRAVIS_TIMESTAMP}, current: ${CURRENT_TIME})"
timeout ${TIMEOUT}s python3 /root/QGIS/.ci/travis/scripts/ctest2travis.py xvfb-run ctest -V -E "$(cat /root/QGIS/.ci/travis/linux/blacklist.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)" -S /root/QGIS/.ci/travis/travis.ctest --output-on-failure
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
2017-09-21 09:07:37 +02:00
########################
# Show ccache statistics
########################
2017-10-07 11:43:52 +02:00
echo "travis_fold:start:ccache.stats"
echo "ccache statistics"
ccache -s
2017-10-07 11:43:52 +02:00
echo "travis_fold:end:ccache.stats"
2017-10-07 09:42:05 +02:00
popd > /dev/null # build
popd > /dev/null # /root/QGIS
2017-09-28 11:43:30 +02:00
[ -r /tmp/ctest-important.log ] && cat /tmp/ctest-important.log || true
2019-03-05 20:59:03 +01:00