testsuite instrumentation fixes by Christian

This commit is contained in:
Denis Vlasenko 2008-05-15 22:43:48 +00:00
parent e251337a4d
commit 81e97a1380
2 changed files with 16 additions and 19 deletions

View File

@ -12,7 +12,7 @@ run_applet_testcase()
local applet="$1" local applet="$1"
local testcase="$2" local testcase="$2"
local status local status=0
local uc_applet=$(echo "$applet" | tr a-z A-Z) local uc_applet=$(echo "$applet" | tr a-z A-Z)
local testname="$testcase" local testname="$testcase"
@ -36,8 +36,8 @@ run_applet_testcase()
cd ".tmpdir.$applet" || return 1 cd ".tmpdir.$applet" || return 1
# echo "Running testcase $testcase" # echo "Running testcase $testcase"
d="$tsdir" sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 d="$tsdir" \
status=$? sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 || status=$?
if [ $status -ne 0 ]; then if [ $status -ne 0 ]; then
echo "FAIL: $testname" echo "FAIL: $testname"
if [ x"$VERBOSE" != x ]; then if [ x"$VERBOSE" != x ]; then
@ -69,8 +69,7 @@ run_oldstyle_applet_tests()
*.mine) continue ;; # svn-produced junk *.mine) continue ;; # svn-produced junk
*.r[0-9]*) continue ;; # svn-produced junk *.r[0-9]*) continue ;; # svn-produced junk
esac esac
run_applet_testcase "$applet" "$testcase" run_applet_testcase "$applet" "$testcase" || status=1
test $? -eq 0 || status=1
done done
return $status return $status
} }
@ -125,8 +124,7 @@ status=0
for applet in $applets; do for applet in $applets; do
# Any old-style tests for this applet? # Any old-style tests for this applet?
if [ -d "$tsdir/$applet" ]; then if [ -d "$tsdir/$applet" ]; then
run_oldstyle_applet_tests "$applet" run_oldstyle_applet_tests "$applet" || status=1
test $? -eq 0 || status=1
fi fi
# Is this a new-style test? # Is this a new-style test?
@ -139,8 +137,8 @@ for applet in $applets; do
fi fi
fi fi
# echo "Running test $tsdir/$applet.tests" # echo "Running test $tsdir/$applet.tests"
PATH="$LINKSDIR:$tsdir:$bindir:$PATH" "$tsdir/$applet.tests" PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \
test $? -eq 0 || status=1 "$tsdir/$applet.tests" || status=1
fi fi
done done

View File

@ -37,7 +37,7 @@ export FAILCOUNT=0
export SKIP= export SKIP=
# Helper for helpers. Oh my... # Helper for helpers. Oh my...
test x"$ECHO" = x"" && { test x"$ECHO" != x"" || {
ECHO="echo" ECHO="echo"
test x"`echo -ne`" = x"" || { test x"`echo -ne`" = x"" || {
# Compile and use a replacement 'echo' which understands -e -n # Compile and use a replacement 'echo' which understands -e -n
@ -68,15 +68,15 @@ optional()
testing() testing()
{ {
NAME="$1" NAME="$1"
[ -z "$1" ] && NAME="$2" [ -n "$1" ] || NAME="$2"
if [ $# -ne 5 ] if [ $# -ne 5 ]
then then
echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2 echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2
exit exit 1
fi fi
[ -n "$DEBUG" ] && set -x [ -z "$DEBUG" ] || set -x
if [ -n "$SKIP" ] if [ -n "$SKIP" ]
then then
@ -90,18 +90,17 @@ testing()
$ECHO -ne "$5" | eval "$2" > actual $ECHO -ne "$5" | eval "$2" > actual
RETVAL=$? RETVAL=$?
cmp expected actual >/dev/null 2>/dev/null if cmp expected actual >/dev/null 2>/dev/null
if [ $? -ne 0 ]
then then
echo "PASS: $NAME"
else
FAILCOUNT=$(($FAILCOUNT + 1)) FAILCOUNT=$(($FAILCOUNT + 1))
echo "FAIL: $NAME" echo "FAIL: $NAME"
[ -n "$VERBOSE" ] && diff -u expected actual [ -z "$VERBOSE" ] || diff -u expected actual
else
echo "PASS: $NAME"
fi fi
rm -f input expected actual rm -f input expected actual
[ -n "$DEBUG" ] && set +x [ -z "$DEBUG" ] || set +x
return $RETVAL return $RETVAL
} }