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-.} srcdir=${srcdir-.}
builddir=${builddir-.} builddir=${builddir-.}
log="$builddir/rulescomp.log" name=rulescomp
prog="$builddir/$name$EXEEXT"
log="$builddir/$name.log"
compile() compile()
{ {
echo "${builddir}/rulescomp '$1' '$2' '$3' '$4' '$5'" >>"$log" echo "$prog '$1' '$2' '$3' '$4' '$5'" >>"$log"
${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1 || exit $? $prog "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1 || exit $?
} }
failcompile() failcompile()
{ {
echo "${builddir}/rulescomp '$1' '$2' '$3' '$4' '$5'" >>"$log" echo "$prog '$1' '$2' '$3' '$4' '$5'" >>"$log"
if ${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1; then if $prog "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1; then
exit 1 exit 1
fi fi
} }

View File

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