Skip to content

Commit 0814b62

Browse files
committed
Move test in its own script
1 parent ed9709b commit 0814b62

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

.ci/travis/linux/docker_test.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
###########################################################################
3+
# docker_test.sh
4+
#
5+
# Run a particular test on docker testing env and return its exit code
6+
#
7+
# Arguments:
8+
#
9+
# $1: test name in dotted notation
10+
#
11+
# ---------------------
12+
# Date : November 2018
13+
# Copyright : (C) 2018 by Alessandro Pasotti
14+
# Email : elpaso at itopen dot it
15+
###########################################################################
16+
# #
17+
# This program is free software; you can redistribute it and/or modify #
18+
# it under the terms of the GNU General Public License as published by #
19+
# the Free Software Foundation; either version 2 of the License, or #
20+
# (at your option) any later version. #
21+
# #
22+
###########################################################################
23+
24+
TEST_NAME=$1
25+
26+
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh ${TEST_NAME}"
27+
28+
echo $?

.ci/travis/linux/script.sh

+8-10
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ else
4242
sleep 10 # Wait for xvfb to finish starting
4343
# Temporary workaround until docker images are built
4444
docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/test_runner/qgis_testrunner.sh qgis-testing-environment:/usr/bin/qgis_testrunner.sh
45-
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_passing"
46-
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_skipped_and_passing"
45+
# Run tests in the docker
46+
# Passing cases:
47+
TEST_SCRIPT_PATH=${TRAVIS_BUILD_DIR}/.ci/linux/docker_test.sh
48+
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_passing) -eq '0' ]]
49+
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_skipped_and_passing) -eq '0' ]]
4750
# Failing cases:
48-
set +e
49-
ret=0 && docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner" || ret=127
50-
[ $ret -eq 127 ] || exit 1 # expected failure
51-
ret=0 && docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_all" || ret=127
52-
[ $ret -eq 127 ] || exit 1 # expected failure
53-
ret=0 && docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_failing" || ret=127
54-
[ $ret -eq 127 ] || exit 1 # expected failure
55-
set -e
51+
[[ $(${TEST_SCRIPT_PATH} test_testrunner) -eq '1' ]]
52+
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_all) -eq '1' ]]
53+
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_failing) -eq '1' ]]
5654
fi

0 commit comments

Comments
 (0)