test_media_select: Replace URL, update patterns
[libquvi.git] / tests / run_tests.sh
bloba05aa3afcda38c7ab838fb8376f2ba61e7bf000e
1 #!/bin/sh
3 # libquvi
4 # Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
6 # This file is part of libquvi <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 # flags
27 M= # run mem tests
28 # arrays
29 T= # tests
31 find_tests()
33 f="`dirname $0`/find_tests.sh"
34 T=`$f | sort -hr` || {
35 echo "error: $! ($?)"
36 exit 1
38 [ -n "$T" ] || {
39 echo "error: tests not found"
40 exit 1
44 choose_skipped_tests()
46 a=; for t in $T; do
47 a="FALSE $t $a"
48 done
49 o='--list --width 320 --height 480 --separator=,'
50 o="$o --column Skip --column Test"
51 T=`$Z $o --checklist $a`
52 export TEST_SKIP="$T"
53 # echo "TEST_SKIP=$TEST_SKIP"
54 return 0
57 choose_test_opts()
59 c='--column Enable --column Test'
60 a='false TEST_INTERNET false TEST_VERBOSE'
61 r=`$Z --width 320 --height 240 --list --checklist $c $a`
62 expr "$r" : ".*INTERNET.*" >/dev/null && export TEST_INTERNET=1
63 expr "$r" : ".*VERBOSE.*" >/dev/null && export TEST_VERBOSE=1
64 return 0
67 run_tests()
69 echo "TEST_INTERNET=$TEST_INTERNET"
70 echo "TEST_VERBOSE=$TEST_VERBOSE"
71 make test
72 return 0
75 run_tests_mem()
77 echo "TODO: run_tests_mem"
78 exit 0
81 help()
83 echo "Usage: $0 [OPTIONS]
85 $0 is a convenience script for running the tests.
87 OPTIONS
88 -h Show this help and exit
89 -m Run target 'test-mem'
91 NOTE: Run 'configure' script first
93 Example:
94 cd \$top_srcdir ; mkdir tmp ; cd tmp
95 ../configure && make && ../$0
97 $0 sets the following environment variables before
98 running the tests:
99 TEST_INTERNET
100 TEST_VERBOSE
101 TEST_SKIP
103 Refer to the curl(1) manual for a complete list of proxy environment
104 variables. The testsuite does not set any by default."
105 exit 0
108 while [ $# -gt 0 ]
110 case "$1" in
111 -h) help;;
112 -m) M=1;;
113 *) break;;
114 esac
115 shift
116 done
118 [ -f "config.log" ] || {
119 echo "error: config.log not found: have you run configure?"
120 exit 1
123 find_tests
124 choose_skipped_tests
125 choose_test_opts
127 if [ -z "$M" ]; then
128 run_tests
129 else
130 run_tests_mem
133 # vim: set ts=2 sw=2 tw=72 expandtab: