1
0

test.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. FAILURES=0
  3. mkdir -p test_out
  4. echo "Running Regression Tests..."
  5. for mrt in `ls test_data`; do
  6. /bin/echo -n " testing $mrt..."
  7. OUT=$mrt.bgp.gz
  8. ./bgpdump -vm test_data/$mrt > test_out/$OUT
  9. gzip -cd test_expect/$OUT | diff -q test_out/$OUT -
  10. if [ $? = 0 ]; then
  11. echo "success"
  12. else
  13. FAILURES=$(( $FAILURES + 1 ))
  14. fi
  15. done
  16. if [ ! -z "$BGPDUMP_TEST_UATTR" ] ; then
  17. for mrt in $(ls test_data) ; do
  18. printf " testing -u %s..." "$mrt"
  19. OUT="$mrt.bgp.gz"
  20. # The pipe into sed removes the last field added by -u on table dump
  21. # and announcement (update files) lines, and allows us to chekc
  22. # everything else is the same without adding new test_expect files
  23. # to the repository.
  24. ./bgpdump -u -vm test_data/$mrt | sed '/|A\|B|/ s/|[^|]*|$/|/' > test_out/$OUT
  25. gzip -cd test_expect/$OUT | diff -q test_out/$OUT -
  26. if [ $? = 0 ]; then
  27. echo "success"
  28. else
  29. FAILURES=$(( FAILURES + 1 ))
  30. fi
  31. done
  32. fi
  33. if [ $FAILURES != 0 ]; then
  34. echo !!! $FAILURES failures !!!
  35. exit 1
  36. else
  37. exit 0
  38. fi