run_test_sip_msg 2.48 KB
Newer Older
1
#! /bin/sh
Pekka Pessi's avatar
Pekka Pessi committed
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
#
# Run the parser tests
#
# usage: env srcdir=dir run_sip_test_msg
#
# --------------------------------------------------------------------
#
# This file is part of the Sofia-SIP package
#
# Copyright (C) 2005 Nokia Corporation.
#
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
#
# --------------------------------------------------------------------
#

rc=0

if test ! -d "${srcdir:=.}/tests"
then
    echo Please set environment variable srcdir
    exit 77
fi

41
test=./test_sip_msg
Pekka Pessi's avatar
Pekka Pessi committed
42 43

# These are messages that the parser should pass
44 45 46
good="-t test1.txt test2.txt test3.txt test4.txt
      -u test5.txt -t test6.txt test7.txt -u test8.txt -t test9.txt
      test14.txt test20.txt test23.txt test24.txt test31.txt
Pekka Pessi's avatar
Pekka Pessi committed
47 48
      own1.txt own2.txt own3.txt own4.txt own5.txt own6.txt"
# These are messages that the parser should fail
49 50 51
bad="test10.txt test11.txt test12.txt test13.txt test15.txt
     test16.txt test17.txt test18.txt test19.txt
     test21.txt test22.txt
Pekka Pessi's avatar
Pekka Pessi committed
52
     test26.txt test29.txt test33.txt
53
     test35.txt
Pekka Pessi's avatar
Pekka Pessi committed
54 55
     test40.txt"
# These are ugly messages that parser should pass
56 57
ugly="-t test25.txt -u test27.txt test28.txt -t test30.txt
      -u test32.txt test34.txt -t test36.txt -u test37.txt
Pekka Pessi's avatar
Pekka Pessi committed
58 59 60 61 62 63 64 65 66
      test38.txt test39.txt test41.txt test42.txt"

# These are messages that parser should pass, but it does not
goodish=""
# These are messages that parser should not pass, but it does
baddish=""

flag=-t
for n in $good $ugly;
67
do
Pekka Pessi's avatar
Pekka Pessi committed
68 69 70 71
    if test $n = -t ; then
	flag=$n
    elif test $n = -u ; then
	flag=
72
    elif "$test" $flag < "$srcdir/tests/$n" > /dev/null ; then
Pekka Pessi's avatar
Pekka Pessi committed
73 74 75 76 77 78 79
	echo "PASS: $n"
    else
	echo "ERROR: $n"; rc=1
    fi
done

for n in $bad;
80 81
do
    if "$test" -t < "$srcdir/tests/$n" > /dev/null 2>/dev/null ; then
Pekka Pessi's avatar
Pekka Pessi committed
82 83 84 85 86 87 88
	echo "ERROR: $n (no error detected)"; rc=1
    else
	echo "PASS: $n"
    fi
done

exit $rc