FIX: media/dailymotion.lua: sequence pattern (PORTpt4)
[libquvi-scripts.git] / tests / run_tests.sh
blob6720e4a71007e4b766e007d3f81d8e838ec48b6b
1 #!/bin/sh
3 # libquvi-scripts
4 # Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
6 # This file part of libquvi-scripts <http://quvi.sourceforge.net/>.
8 # This program is free software: you can redistribute it and/or
9 # modify it under the terms of the GNU Affero General Public
10 # License as published by the Free Software Foundation, either
11 # version 3 of the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General
19 # Public License along with this program. If not, see
20 # <http://www.gnu.org/licenses/>.
22 set -e
24 # cmds
25 Z='zenity'
26 # arrays
27 T= # tests
29 find_tests()
31 f="`dirname $0`/find_tests.sh"
32 T=`$f | sort -hr` || {
33 echo "error: $! ($?)"
34 exit 1
36 [ -n "$T" ] || {
37 echo "error: tests not found"
38 exit 1
42 enter_custom_test_skip()
44 T=`$Z --entry --text="Enter:" \
45 --entry-text="(comma-separated, patterns OK)" \
46 --width=320 --height=180 \
47 --title="Enter a custom value for TEST_SKIP"`
48 export TEST_SKIP="$T"
49 echo "TEST_SKIP=$TEST_SKIP"
50 return 0
53 choose_skipped_tests()
55 a=; for t in $T; do
56 a="FALSE $t $a"
57 done
58 o='--list --width 320 --height 480 --separator=,'
59 o="$o --column Skip --column Test"
60 T=`$Z $o --checklist false enter_custom $a`
61 expr "$T" : ".*enter_custom.*" >/dev/null && enter_custom_test_skip
62 export TEST_SKIP="$T"
63 # echo "TEST_SKIP=$TEST_SKIP"
64 return 0
67 choose_test_level()
69 o='--list --radiolist --width 320 --height 240'
70 o="$o --column Enable --column Level true basic false complete"
71 T=`$Z $o`
72 export TEST_LEVEL="$T"
73 # echo "TEST_LEVEL=$TEST_LEVEL"
74 return 0
77 choose_test_opts()
79 c='--column Enable --column Test'
80 a='false TEST_GEOBLOCKED false TEST_VERBOSE false TEST_NSFW false TEST_FIXME'
81 r=`$Z --width 320 --height 240 --list --checklist $c $a`
82 expr "$r" : ".*GEOBLOCKED.*" >/dev/null && export TEST_GEOBLOCKED=1
83 expr "$r" : ".*VERBOSE.*" >/dev/null && export TEST_VERBOSE=1
84 expr "$r" : ".*FIXME.*" >/dev/null && export TEST_FIXME=1
85 expr "$r" : ".*NSFW.*" >/dev/null && export TEST_NSFW=1
86 return 0
89 run_tests()
91 echo "TEST_GEOBLOCKED=$TEST_GEOBLOCKED"
92 echo "TEST_VERBOSE=$TEST_VERBOSE"
93 echo "TEST_FIXME=$TEST_FIXME"
94 echo "TEST_NSFW=$TEST_NSFW"
95 make test
96 return 0
99 help()
101 echo "Usage: $0 [OPTIONS]
103 $0 is a convenience script for running the tests.
105 OPTIONS
106 -h Show this help and exit
108 NOTE: Run 'configure' script first
110 Example:
111 cd \$top_srcdir ; mkdir tmp ; cd tmp
112 ../configure && make && ../$0
114 $0 sets the following environment variables before
115 running the tests:
116 TEST_GEOBLOCKED
117 TEST_VERBOSE
118 TEST_FIXME
119 TEST_NSFW
120 TEST_SKIP
122 NOTE: You must set any HTTP proxy environment variables (e.g.
123 http_proxy) manually. Refer to curl(1) manual page for a list
124 of the supported variables."
125 exit 0
128 while [ $# -gt 0 ]
130 case "$1" in
131 -h) help;;
132 *) break;;
133 esac
134 shift
135 done
137 [ -f "config.log" ] || {
138 echo "error: config.log not found: have you run configure?"
139 exit 1
142 find_tests
143 choose_skipped_tests
144 choose_test_level
145 choose_test_opts
146 run_tests
148 # vim: set ts=2 sw=2 tw=72 expandtab: