123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- Description: Enhance the test script
- Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
- Forwarded: No
- Last-Update: 2014-07-22
- Handle alternate paths for the test data, handle alternate
- compressions.
- --- a/test.sh
- +++ b/test.sh
- @@ -2,14 +2,44 @@
-
- FAILURES=0
-
- -mkdir -p test_out
- +DIR="${1:-.}"
- +
- +if [ ! -d "$DIR" ] ; then
- + echo "Not a directory: $DIR"
- + exit 2
- +fi
- +
- +if [ -x "$(which gzcat)" ] ; then
- + ZCAT=gzcat
- +elif [ -x "$(which zcat)" ] ; then
- + ZCAT=zcat
- +else
- + echo "Have neither zcat or gzcat"
- + exit 2
- +fi
- +
- +mkdir -p "$DIR/test_out"
-
- echo "Running Regression Tests..."
- -for mrt in `ls test_data`; do
- - /bin/echo -n " testing $mrt..."
- - OUT=$mrt.bgp.gz
- - ./bgpdump -vm test_data/$mrt > test_out/$OUT
- - gzip -cd test_expect/$OUT | diff -q test_out/$OUT -
- +for mrt in $(find "$DIR/test_data/" -maxdepth 1 -type f -printf '%f\n' | grep -E '\.(gz|bz2|xz)' | sort) ; do
- + echo -n " testing $mrt..."
- + OUT=$mrt.bgp
- + ./bgpdump -vm "$DIR/test_data/$mrt" > "$DIR/test_out/$OUT"
- + if [ -f "$DIR/test_expect/$OUT.gz" ] ; then
- + EXT=gz
- + CAT="$ZCAT"
- + elif [ -f "$DIR/test_expect/$OUT.bz2" ] ; then
- + EXT=bz2
- + CAT='bzcat'
- + elif [ -f "$DIR/test_expect/$OUT.xz" ] ; then
- + EXT=xz
- + CAT='xzcat'
- + else
- + echo "Have no expect data"
- + exit 2
- + fi
- +
- + "$CAT" "$DIR/test_expect/$OUT.$EXT" | diff -q "$DIR/test_out/$OUT" -
- if [ $? = 0 ]; then
- echo "success"
- else
- --- a/Makefile.am
- +++ b/Makefile.am
- @@ -11,4 +11,5 @@
- rm -f test_out/*.bgp.gz
-
- test: check-clean bgpdump
- + ./test.sh debian/tests/
- @[ -d test_data ] && ./test.sh || echo "Skipping upstream tests as they are huge (see README.Debian)"
|