3 # Copyright (c) 2015 Marcus Rohrmoser http://mro.name/me. All rights reserved.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 curl
--version >/dev
/null ||
{ echo "I need curl." && exit 101 ; }
21 xmllint
--version 2> /dev
/null ||
{ echo "I need xmllint." && exit 102 ; }
22 ruby
--version > /dev
/null ||
{ echo "I need xmllint." && exit 103 ; }
24 cd "$(dirname "$0")/.."
27 # terminal colors (require bash)
28 # http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
29 # http://wiki.bash-hackers.org/scripting/terminalcodes
33 FGC_GREEN
="\033[1;32m"
34 FGC_YELLOW
="\033[1;33m"
36 FGC_PURPLE
="\033[1;35m"
38 FGC_WHITE
="\033[1;37m"
41 BGC_GREEN
="\033[7;32m"
42 BGC_YELLOW
="\033[7;33m"
44 BGC_PURPLE
="\033[7;35m"
46 BGC_WHITE
="\033[7;37m"
48 echo "\$ curl --version" ; curl
--version
51 for tst
in .
/scripts
/test*.sh
53 test_name
="$(basename "$tst")"
54 echo -n "travis_fold:start:${test_name}\r"
55 echo -n "Running $test_name "
58 # prepare a clean test environment from scratch
59 rm scripts
/curl.
* 1>/dev
/null
2>&1
61 # ...and unpack into directory 'WebAppRoot'...
62 tar -xzf source.
tar.gz ||
{ echo "ouch" && exit 1 ; }
63 mv $GITHUB_SRC_SUBDIR WebAppRoot
65 # http://robbiemackay.com/2013/05/03/automating-behat-and-mink-tests-with-travis-ci/
67 php
-S 127.0.0.1:8000 -t WebAppRoot
1> php.stdout
2> php.stderr
&
68 sleep 1 # how could we get rid of this stupid sleep?
70 ls -l "WebAppRoot/index.php" >/dev
/null ||
{ echo "ouch" && exit 2 ; }
72 curl
--silent --show-error \
74 --data-urlencode "setlogin=$USERNAME" \
75 --data-urlencode "setpassword=$PASSWORD" \
76 --data-urlencode "continent=Europe" \
77 --data-urlencode "city=Brussels" \
78 --data-urlencode "title=Review Shaarli" \
79 --data-urlencode "Save=Save config" \
86 killall php
1>/dev
/null
2>&1
87 if [ $code -ne 0 ] ; then
88 for f
in scripts
/curl.
* WebAppRoot
/data
/log.txt
; do
89 printf " %-60s \n" "_${f}_" |
tr ' _' '# '
94 echo -n "travis_fold:end:${test_name}\r"
96 if [ $code -eq 0 ] ; then
97 echo "${FGC_GREEN}✓${FGC_NONE} ${test_name}"
99 echo "${FGC_RED}✗${FGC_NONE} ${test_name} (code: $code)"