run_test_sip_msg 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #! /bin/sh
  2. #
  3. # Run the parser tests
  4. #
  5. # usage: env srcdir=dir run_sip_test_msg
  6. #
  7. # --------------------------------------------------------------------
  8. #
  9. # This file is part of the Sofia-SIP package
  10. #
  11. # Copyright (C) 2005 Nokia Corporation.
  12. #
  13. # Contact: Pekka Pessi <pekka.pessi@nokia.com>
  14. #
  15. # This library is free software; you can redistribute it and/or
  16. # modify it under the terms of the GNU Lesser General Public License
  17. # as published by the Free Software Foundation; either version 2.1 of
  18. # the License, or (at your option) any later version.
  19. #
  20. # This library is distributed in the hope that it will be useful, but
  21. # WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23. # Lesser General Public License for more details.
  24. #
  25. # You should have received a copy of the GNU Lesser General Public
  26. # License along with this library; if not, write to the Free Software
  27. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  28. # 02110-1301 USA
  29. #
  30. # --------------------------------------------------------------------
  31. #
  32. rc=0
  33. if test ! -d "${srcdir:=.}/tests"
  34. then
  35. echo Please set environment variable srcdir
  36. exit 77
  37. fi
  38. test=./test_sip_msg
  39. # These are messages that the parser should pass
  40. good="-t test1.txt test2.txt test3.txt test4.txt
  41. -u test5.txt -t test6.txt test7.txt -u test8.txt -t test9.txt
  42. test14.txt test20.txt test23.txt test24.txt test31.txt
  43. own1.txt own2.txt own3.txt own4.txt own5.txt own6.txt"
  44. # These are messages that the parser should fail
  45. bad="test10.txt test11.txt test12.txt test13.txt test15.txt
  46. test16.txt test17.txt test18.txt test19.txt
  47. test21.txt test22.txt
  48. test26.txt test29.txt test33.txt
  49. test35.txt
  50. test40.txt"
  51. # These are ugly messages that parser should pass
  52. ugly="-t test25.txt -u test27.txt test28.txt -t test30.txt
  53. -u test32.txt test34.txt -t test36.txt -u test37.txt
  54. test38.txt test39.txt test41.txt test42.txt"
  55. # These are messages that parser should pass, but it does not
  56. goodish=""
  57. # These are messages that parser should not pass, but it does
  58. baddish=""
  59. flag=-t
  60. for n in $good $ugly;
  61. do
  62. if test $n = -t ; then
  63. flag=$n
  64. elif test $n = -u ; then
  65. flag=
  66. elif "$test" $flag < "$srcdir/tests/$n" > /dev/null ; then
  67. echo "PASS: $n"
  68. else
  69. echo "ERROR: $n"; rc=1
  70. fi
  71. done
  72. for n in $bad;
  73. do
  74. if "$test" -t < "$srcdir/tests/$n" > /dev/null 2>/dev/null ; then
  75. echo "ERROR: $n (no error detected)"; rc=1
  76. else
  77. echo "PASS: $n"
  78. fi
  79. done
  80. exit $rc