test: Minor refactor to allow $EXEEXT in program names

master
Dan Nicholson 2009-04-04 11:04:35 -07:00
parent 8f9a612990
commit 4f736db995
2 changed files with 14 additions and 10 deletions

View File

@ -3,18 +3,20 @@
srcdir=${srcdir-.}
builddir=${builddir-.}
log="$builddir/rulescomp.log"
name=rulescomp
prog="$builddir/$name$EXEEXT"
log="$builddir/$name.log"
compile()
{
echo "${builddir}/rulescomp '$1' '$2' '$3' '$4' '$5'" >>"$log"
${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1 || exit $?
echo "$prog '$1' '$2' '$3' '$4' '$5'" >>"$log"
$prog "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1 || exit $?
}
failcompile()
{
echo "${builddir}/rulescomp '$1' '$2' '$3' '$4' '$5'" >>"$log"
if ${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1; then
echo "$prog '$1' '$2' '$3' '$4' '$5'" >>"$log"
if $prog "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1; then
exit 1
fi
}

View File

@ -3,7 +3,9 @@
srcdir=${srcdir-.}
builddir=${builddir-.}
log="$builddir/xkey.log"
name=xkey
prog="$builddir/$name$EXEEXT"
log="$builddir/$name.log"
check_error()
{
@ -17,8 +19,8 @@ check_error()
check_string()
{
echo "${builddir}/xkey -s '$1'" >>"$log"
val=`${builddir}/xkey -s "$1"` &&
echo "$prog -s '$1'" >>"$log"
val=`$prog -s "$1"` &&
echo "$val" >>"$log" &&
check_error "$1" "$2" "$val" >>"$log" 2>&1 ||
exit $?
@ -26,8 +28,8 @@ check_string()
check_key()
{
echo "${builddir}/xkey -k '$1'" >>"$log"
val=`${builddir}/xkey -k "$1"` && \
echo "$prog -k '$1'" >>"$log"
val=`$prog -k "$1"` && \
echo "$val" >>"$log" &&
check_error "$1" "$2" "$val" >>"$log" 2>&1 || \
exit $?