1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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
- +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.gz
- - ./bgpdump -vm test_data/$mrt > test_out/$OUT
- - gzcat test_expect/$OUT | diff -q test_out/$OUT -
- + 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)"
|