aboutsummaryrefslogtreecommitdiff
path: root/test/run-tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/run-tests.sh')
-rwxr-xr-xtest/run-tests.sh32
1 files changed, 15 insertions, 17 deletions
diff --git a/test/run-tests.sh b/test/run-tests.sh
index 3b82bc2..c6a7cce 100755
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -1,7 +1,5 @@
#!/bin/sh
-err_file="stderr.tmp"
-out_file="stdout.tmp"
EXECUTABLE="$PWD/../cue-bin-split"
fail()
@@ -10,29 +8,29 @@ fail()
exit 1
}
+check_expected()
+{
+ [ -z $1 ] && echo WARN: check_expected called with no argument
+ if [ -f $1.expected ] ; then
+ diff $1.expected $1.tmp >/dev/null
+ if [ $? -ne 0 ] ; then
+ fail "$1 didn't match expected"
+ fi
+ fi
+}
+
for i in *.test ; do
pushd ${i} >/dev/null
- ( . ./run.sh ) 2>${err_file} >${out_file}
+ ( . ./run.sh ) 2>stderr.tmp >stdout.tmp
if [ $? -ne 0 ] ; then
fail "script had non-zero return code"
fi
- if [ -f stderr.expected ] ; then
- diff stderr.expected stderr.tmp
- if [ $? -ne 0 ] ; then
- fail "stderr didn't match expected"
- fi
- fi
-
- if [ -f stdout.expected ] ; then
- diff stdout.expected stdout.tmp
- if [ $? -ne 0 ] ; then
- fail "stdout didn't match expected"
- fi
- fi
+ check_expected stdout
+ check_expected stderr
echo "[PASS] $i"
- rm ${err_file} ${out_file}
+ rm std{err,out}.tmp
popd >/dev/null
done