make sure we exit based on test failure rather than always exiting with 0
This commit is contained in:
parent
25a6ca0dd4
commit
42ab86520e
@ -25,6 +25,7 @@ do_test()
|
|||||||
test -d "$1" || return 0
|
test -d "$1" || return 0
|
||||||
# echo Running tests in directory "$1"
|
# echo Running tests in directory "$1"
|
||||||
(
|
(
|
||||||
|
tret=0
|
||||||
cd "$1" || { echo "cannot cd $1!"; exit 1; }
|
cd "$1" || { echo "cannot cd $1!"; exit 1; }
|
||||||
for x in run-*; do
|
for x in run-*; do
|
||||||
test -f "$x" || continue
|
test -f "$x" || continue
|
||||||
@ -48,26 +49,31 @@ do_test()
|
|||||||
{
|
{
|
||||||
"$THIS_SH" "./$x" >"$name.xx" 2>&1
|
"$THIS_SH" "./$x" >"$name.xx" 2>&1
|
||||||
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
|
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
|
||||||
} && echo "$1/$x: ok" || echo "$1/$x: fail"
|
} && echo "$1/$x: ok" || { echo "$1/$x: fail"; ((tret+=1)); }
|
||||||
done
|
done
|
||||||
|
exit ${tret}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main part of this script
|
# Main part of this script
|
||||||
# Usage: run-all [directories]
|
# Usage: run-all [directories]
|
||||||
|
|
||||||
|
ret=0
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
# All sub directories
|
# All sub directories
|
||||||
modules=`ls -d hush-*`
|
modules=`ls -d hush-*`
|
||||||
|
|
||||||
for module in $modules; do
|
for module in $modules; do
|
||||||
do_test $module
|
do_test $module || ret=1
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
while [ $# -ge 1 ]; do
|
while [ $# -ge 1 ]; do
|
||||||
if [ -d $1 ]; then
|
if [ -d $1 ]; then
|
||||||
do_test $1
|
do_test $1 || ret=1
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit ${ret}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user