blob: 1f1d4daddcb578fe8fda5f67a6fbd2589bdf45d9 (
plain)
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
|
#!/bin/sh
#
# The regression-test driver script. This used to be explicit in the
# makefile before we regrouped the regression tests by stable and unstable
# drivers.
#
PATH=.:$PATH
export PATH
# This works around an obscure bug in pty handling that we encounter
# when using 2.5.x built with gcc 4.3.2 or later. The symptom is simple:
# gpsfake hangs. For debugging purposes, you can force the version by
# setting the nvironment variable GPSFAKE_PYTHON.
python=python
if [ "$GPSFAKE_PYTHON" ]
then
python=$GPSFAKE_PYTHON
echo "Using $python."
elif [ -x /usr/bin/python2.4 ]
then
python=python2.4
echo "Using $python."
fi
mode=regress
while getopts trbvo:n opt
do
case $opt in
t) mode=regress ;; # Run regression tests
r) mode=superraw ;; # Run superraw regressions (r=2 mode)
b) mode=build ;; # Rebuild regression check files
v) mode=view ;; # View result of generating a check file
o) opts="$OPTARG" ;; # Pass options to gpsfake
n) do=echo ;; # Just echo commands, don't do them
esac
done
shift $(($OPTIND - 1))
case $mode in
regress)
echo "Testing the daemon..."
errors=0; total=0; notfound=0;
for f in $*; do
dir=`dirname $f`
if [ -r $f.chk ]
then
$do $python gpsfake -s 38400 -1 -b -p $opts ${f} | grep -v "^GPSD,X" >$dir/test.chk;
if $do diff -ub ${f}.chk $dir/test.chk; then :; else
errors=`expr $errors + 1`;
fi;
else
echo "*** No check log $f.chk exists"
notfound=`expr $notfound + 1`;
fi
total=`expr $total + 1`;
done;
$do rm -f $dir/test.chk;
if test $errors -gt 0; then
echo "Regression test FAILED: $errors errors in $total tests total ($notfound not found).";
exit 1;
else
echo "Regression test successful: no errors in $total tests ($notfound not found).";
exit 0;
fi
;;
superraw)
echo "Testing super-raw mode..."
for f in $*; do
dir=`dirname $f`
$do $python gpsfake -s 38400 -1 -b -p -r "r=2" $opts ${f} \
| ./striplog -1 >$dir/test1.chk;
$do ./striplog <$${f} >$dir/test2.chk;
$do cmp $dir/test[12].chk;
done; rm $dir/test[12].chk
;;
build)
echo "Rebuilding regressions..."
for f in $*; do
$do $python gpsfake -s 38400 -1 -b -p $opts ${f} | grep -v "^GPSD,X" >${f}.chk;
done
exit 0
;;
view)
echo "Viewing..."
for f in $*; do
$do gpsfake -s 38400 -1 -b -p $opts ${f}
done
exit 0
;;
esac
|