summaryrefslogtreecommitdiff
path: root/regress-driver
blob: 16defd72002cdbc1e7737cfdf08d2bdd7dd714b2 (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
#!/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

case $1 in
    -t)
        shift
        echo "Testing the daemon..."
        mkdir -p test
        errors=0; total=0;
        for f in $*; do
            dir=`dirname $f`
            gpsfake -s 38400 -1 -b -p ${f} | grep -v "^GPSD,X" >$dir/test.chk;
            if diff -ub ${f}.chk $dir/test.chk; then :; else
                errors=`expr $errors + 1`;
            fi;
            total=`expr $total + 1`;
        done; rm $dir/test.chk;
        if test $errors -gt 0; then
            echo "Regression test FAILED: $errors errors in $total tests total.";
            exit 1;
        else
            echo "Regression test successful: no errors in $total tests.";
            exit 0;
        fi
        ;;
    -r)
        echo "Testing super-raw mode..."
        mkdir -p test
        for f in $*; do
            dir=`dirname $f`
            gpsfake -s 38400 -1 -b -p -r "r=2" ${f} \
            | ./striplog -1 >$dir/test1.chk;
            ./striplog <$${f} >$dir/test2.chk;
            cmp $dir/test[12].chk;
        done; rm $dir/test[12].chk
        ;;
    -b)
        echo "Rebuilding regressions..."
        shift
        for f in $*; do
            gpsfake -s 38400 -1 -b -p ${f} | grep -v "^GPSD,X" >${f}.chk;
        done
        exit 0
        ;;
esac