File: run_tests.sh

package info (click to toggle)
libquvi 0.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,960 kB
  • sloc: sh: 12,286; ansic: 9,521; makefile: 653; sed: 16
file content (133 lines) | stat: -rwxr-xr-x 2,677 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
#
# libquvi
# Copyright (C) 2012  Toni Gundogdu <legatvs@gmail.com>
#
# This file is part of libquvi <http://quvi.sourceforge.net/>.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General
# Public License along with this program.  If not, see
# <http://www.gnu.org/licenses/>.
#
set -e

# cmds
Z='zenity'
# flags
M= # run mem tests
# arrays 
T= # tests

find_tests()
{
  f="`dirname $0`/find_tests.sh"
  T=`$f | sort -hr` || {
    echo "error: $! ($?)"
    exit 1
  }
  [ -n "$T" ] || {
    echo "error: tests not found"
    exit 1
  }
}

choose_skipped_tests()
{
  a=; for t in $T; do
    a="FALSE $t $a"
  done
  o='--list --width 320 --height 480 --separator=,'
  o="$o --column Skip --column Test"
  T=`$Z $o --checklist $a`
  export TEST_SKIP="$T"
#  echo "TEST_SKIP=$TEST_SKIP"
  return 0
}

choose_test_opts()
{
  c='--column Enable --column Test'
  a='false TEST_INTERNET false TEST_VERBOSE'
  r=`$Z --width 320 --height 240 --list --checklist $c $a`
  expr "$r" : ".*INTERNET.*" >/dev/null && export TEST_INTERNET=1
  expr "$r" : ".*VERBOSE.*" >/dev/null && export TEST_VERBOSE=1
  return 0
}

run_tests()
{
  echo "TEST_INTERNET=$TEST_INTERNET"
  echo "TEST_VERBOSE=$TEST_VERBOSE"
  make test
  return 0
}

run_tests_mem()
{
  echo "TODO: run_tests_mem"
  exit 0
}

help()
{
  echo "Usage: $0 [OPTIONS]

$0 is a convenience script for running the tests.

OPTIONS
  -h  Show this help and exit
  -m  Run target 'test-mem'

NOTE: Run 'configure' script first

  Example:
    cd \$top_srcdir ; mkdir tmp ; cd tmp
    ../configure && make && ../$0

$0 sets the following environment variables before
running the tests:
  TEST_INTERNET
  TEST_VERBOSE
  TEST_SKIP

Refer to the curl(1) manual for a complete list of proxy environment
variables. The testsuite does not set any by default."
  exit 0
}

while [ $# -gt 0 ]
do
  case "$1" in
    -h) help;;
    -m) M=1;;
    *) break;;
  esac
  shift
done

[ -f "config.log" ] || {
  echo "error: config.log not found: have you run configure?"
  exit 1
}

find_tests
choose_skipped_tests
choose_test_opts

if [ -z "$M" ]; then
  run_tests
else
  run_tests_mem
fi

# vim: set ts=2 sw=2 tw=72 expandtab: