summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntti-Juhani Kaijanaho <ajk@debian.org>2010-08-28 11:48:39 +0300
committerAntti-Juhani Kaijanaho <ajk@debian.org>2010-08-28 11:48:39 +0300
commit710b0a4e092611343e008653d7f9dc2a35592e00 (patch)
treedf9006cb8ab46807ae45bc1627dd66b29c8b0f69
parent7287a729c6c3e490c3e54e5288073360662bbbed (diff)
downloaddctrl-tools-710b0a4e092611343e008653d7f9dc2a35592e00.tar.gz
tester.sh: Support stderr verification
Signed-off-by: Antti-Juhani Kaijanaho <ajk@debian.org>
-rw-r--r--tester.sh44
1 files changed, 30 insertions, 14 deletions
diff --git a/tester.sh b/tester.sh
index 0debf24..55d0b6a 100644
--- a/tester.sh
+++ b/tester.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# dctrl-tools - Debian control file inspection tools
-# Copyright (C) 2007 Antti-Juhani Kaijanaho
+# Copyright (C) 2007, 2010 Antti-Juhani Kaijanaho
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,13 +18,13 @@
set -e
-trap "rm .testout .diffout 2>/dev/null" \
+trap "rm .testout .diffout .testerr .differr 2>/dev/null" \
EXIT ABRT BUS FPE HUP ILL QUIT SEGV TERM
-GREP_DCTRL=$PWD/grep-dctrl/grep-dctrl
-SORT_DCTRL=$PWD/sort-dctrl/sort-dctrl
-TBL_DCTRL=$PWD/tbl-dctrl/tbl-dctrl
-JOIN_DCTRL=$PWD/join-dctrl/join-dctrl
+GREP_DCTRL=../grep-dctrl/grep-dctrl
+SORT_DCTRL=../sort-dctrl/sort-dctrl
+TBL_DCTRL=../tbl-dctrl/tbl-dctrl
+JOIN_DCTRL=../join-dctrl/join-dctrl
export GREP_DCTRL SORT_DCTRL TBL_DCTRL JOIN_DCTRL
cd tests
@@ -41,6 +41,7 @@ for tst in $tests ; do
tst_base=`basename $tst .sh`
tst_in=$tst_base.in
tst_out=$tst_base.out
+ tst_ero=$tst_base.err
tst_err=$tst_base.fails
if [ ! -r $tst_in ] ; then
tst_in=/dev/null
@@ -54,22 +55,37 @@ for tst in $tests ; do
else
echo -n "$0: Test case $tst_base (expecting success)..."
fi
- if sh $tst < $tst_in > .testout ; then
+ ok=true
+ if sh $tst < $tst_in > .testout 2> .testerr ; then
if diff -au $tst_out .testout > .diffout ; then
- echo "ok."
+ :
else
- echo "FAILED."
- cat .diffout
- rv=1
+ ok=false
fi
else
if [ -r $tst_err ] ; then
- echo "ok."
+ :
else
- echo "FAILED."
- rv=1
+ ok=false
fi
fi
+ if [ -r $tst_ero ] ; then
+ if diff -au $tst_ero .testerr > .differr ; then
+ :
+ else
+ ok=false
+ fi
+ fi
+ if $ok ; then
+ echo "ok."
+ else
+ echo "FAILED."
+ echo "stdout diff:"
+ cat .diffout
+ echo "stderr diff:"
+ cat .differr
+ rv=1
+ fi
done
exit $rv