Skip to content

Commit

Permalink
Move test in its own script
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 20, 2018
1 parent ed9709b commit 0814b62
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
28 changes: 28 additions & 0 deletions .ci/travis/linux/docker_test.sh
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
###########################################################################
# docker_test.sh
#
# Run a particular test on docker testing env and return its exit code
#
# Arguments:
#
# $1: test name in dotted notation
#
# ---------------------
# Date : November 2018
# Copyright : (C) 2018 by Alessandro Pasotti
# Email : elpaso at itopen dot it
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################

TEST_NAME=$1

docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh ${TEST_NAME}"

echo $?
18 changes: 8 additions & 10 deletions .ci/travis/linux/script.sh
Expand Up @@ -42,15 +42,13 @@ else
sleep 10 # Wait for xvfb to finish starting
# Temporary workaround until docker images are built
docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/test_runner/qgis_testrunner.sh qgis-testing-environment:/usr/bin/qgis_testrunner.sh
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_passing"
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_skipped_and_passing"
# Run tests in the docker
# Passing cases:
TEST_SCRIPT_PATH=${TRAVIS_BUILD_DIR}/.ci/linux/docker_test.sh
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_passing) -eq '0' ]]
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_skipped_and_passing) -eq '0' ]]
# Failing cases:
set +e
ret=0 && docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner" || ret=127
[ $ret -eq 127 ] || exit 1 # expected failure
ret=0 && docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_all" || ret=127
[ $ret -eq 127 ] || exit 1 # expected failure
ret=0 && docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh test_testrunner.run_failing" || ret=127
[ $ret -eq 127 ] || exit 1 # expected failure
set -e
[[ $(${TEST_SCRIPT_PATH} test_testrunner) -eq '1' ]]
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_all) -eq '1' ]]
[[ $(${TEST_SCRIPT_PATH} test_testrunner.run_failing) -eq '1' ]]
fi

1 comment on commit 0814b62

@3nids
Copy link
Member

@3nids 3nids commented on 0814b62 Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elpaso do you still plan to move the rest of this to a dedicated script?

Please sign in to comment.