|
@@ -8,12 +8,13 @@ Last-Update: 2014-07-22
|
|
|
|
|
|
--- a/test.sh
|
|
--- a/test.sh
|
|
+++ b/test.sh
|
|
+++ b/test.sh
|
|
-@@ -2,14 +2,44 @@
|
|
|
|
|
|
+@@ -2,14 +2,45 @@
|
|
|
|
|
|
FAILURES=0
|
|
FAILURES=0
|
|
|
|
|
|
-mkdir -p test_out
|
|
-mkdir -p test_out
|
|
+DIR="${1:-.}"
|
|
+DIR="${1:-.}"
|
|
|
|
++BGPDUMP="${2:-./bgpdump}"
|
|
+
|
|
+
|
|
+if [ ! -d "$DIR" ] ; then
|
|
+if [ ! -d "$DIR" ] ; then
|
|
+ echo "Not a directory: $DIR"
|
|
+ echo "Not a directory: $DIR"
|
|
@@ -40,7 +41,7 @@ Last-Update: 2014-07-22
|
|
+for mrt in $(find "$DIR/test_data/" -maxdepth 1 -type f -printf '%f\n' | grep -E '\.(gz|bz2|xz)' | sort) ; 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..."
|
|
+ echo -n " testing $mrt..."
|
|
+ OUT=$mrt.bgp
|
|
+ OUT=$mrt.bgp
|
|
-+ ./bgpdump -vm "$DIR/test_data/$mrt" > "$DIR/test_out/$OUT"
|
|
|
|
|
|
++ "$BGPDUMP" -vm "$DIR/test_data/$mrt" > "$DIR/test_out/$OUT"
|
|
+ if [ -f "$DIR/test_expect/$OUT.gz" ] ; then
|
|
+ if [ -f "$DIR/test_expect/$OUT.gz" ] ; then
|
|
+ EXT=gz
|
|
+ EXT=gz
|
|
+ CAT="$ZCAT"
|
|
+ CAT="$ZCAT"
|
|
@@ -59,3 +60,20 @@ Last-Update: 2014-07-22
|
|
if [ $? = 0 ]; then
|
|
if [ $? = 0 ]; then
|
|
echo "success"
|
|
echo "success"
|
|
else
|
|
else
|
|
|
|
+@@ -18,14 +49,14 @@
|
|
|
|
+ done
|
|
|
|
+
|
|
|
|
+ if [ ! -z "$BGPDUMP_TEST_UATTR" ] ; then
|
|
|
|
+-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
|
|
|
|
+ printf " testing -u %s..." "$mrt"
|
|
|
|
+ OUT="$mrt.bgp.gz"
|
|
|
|
+ # The pipe into sed removes the last field added by -u on table dump
|
|
|
|
+ # and announcement (update files) lines, and allows us to chekc
|
|
|
|
+ # everything else is the same without adding new test_expect files
|
|
|
|
+ # to the repository.
|
|
|
|
+- ./bgpdump -u -vm test_data/$mrt | sed '/|A\|B|/ s/|[^|]*|$/|/' > test_out/$OUT
|
|
|
|
++ "$BGPDUMP" -u -vm test_data/$mrt | sed '/|A\|B|/ s/|[^|]*|$/|/' > test_out/$OUT
|
|
|
|
+ gzip -cd test_expect/$OUT | diff -q test_out/$OUT -
|
|
|
|
+ if [ $? = 0 ]; then
|
|
|
|
+ echo "success"
|