Rename verify_new.c
[libquvi.git] / tests / run_tests.sh
blob11c2fcb789d4a9ff1e23bef40b9a6fcd64057d7f
1 #!/bin/sh
3 # libquvi
4 # Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301 USA
21 set -e
23 # cmds
24 Z='zenity'
25 # flags
26 M= # run mem tests
27 # arrays
28 T= # tests
30 find_tests()
32 f="`dirname $0`/find_tests.sh"
33 T=`$f | sort -hr` || {
34 echo "error: $! ($?)"
35 exit 1
37 [ -n "$T" ] || {
38 echo "error: tests not found"
39 exit 1
43 choose_skipped_tests()
45 a=; for t in $T; do
46 a="FALSE $t $a"
47 done
48 o='--list --width 320 --height 480 --separator=,'
49 o="$o --column Skip --column Test"
50 T=`$Z $o --checklist $a`
51 export TEST_SKIP="$T"
52 # echo "TEST_SKIP=$TEST_SKIP"
53 return 0
56 choose_test_opts()
58 c='--column Enable --column Test'
59 a='false TEST_INTERNET false TEST_VERBOSE'
60 r=`$Z --width 320 --height 240 --list --checklist $c $a`
61 expr "$r" : ".*INTERNET.*" >/dev/null && export TEST_INTERNET=1
62 expr "$r" : ".*VERBOSE.*" >/dev/null && export TEST_VERBOSE=1
63 return 0
66 run_tests()
68 echo "TEST_INTERNET=$TEST_INTERNET"
69 echo "TEST_VERBOSE=$TEST_VERBOSE"
70 make test
71 return 0
74 run_tests_mem()
76 echo "TODO: run_tests_mem"
77 exit 0
80 help()
82 echo "Usage: $0 [OPTIONS]
84 $0 is a convenience script for running the tests.
86 OPTIONS
87 -h Show this help and exit
88 -m Run target 'test-mem'
90 NOTE: Run 'configure' script first
92 Example:
93 cd \$top_srcdir ; mkdir tmp ; cd tmp
94 ../configure && make && ../$0
96 $0 sets the following environment variables before
97 running the tests:
98 TEST_INTERNET
99 TEST_VERBOSE
100 TEST_SKIP
102 Refer to the curl(1) manual for a complete list of proxy environment
103 variables. The testsuite does not set any by default."
104 exit 0
107 while [ $# -gt 0 ]
109 case "$1" in
110 -h) help;;
111 -m) M=1;;
112 *) break;;
113 esac
114 shift
115 done
117 [ -f "config.log" ] || {
118 echo "error: config.log not found: have you run configure?"
119 exit 1
122 find_tests
123 choose_skipped_tests
124 choose_test_opts
126 if [ -z "$M" ]; then
127 run_tests
128 else
129 run_tests_mem
132 # vim: set ts=2 sw=2 tw=72 expandtab: