Commit 4f736db995a593e4fbb692a62aa1c9cf85843bba

Dan Nicholson 2009-04-04T11:04:35

test: Minor refactor to allow $EXEEXT in program names

diff --git a/test/rulescomp.sh b/test/rulescomp.sh
index 948d7dc..9309d96 100755
--- a/test/rulescomp.sh
+++ b/test/rulescomp.sh
@@ -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
 }
diff --git a/test/xkey.sh b/test/xkey.sh
index 6aa3dd6..7e6b16b 100755
--- a/test/xkey.sh
+++ b/test/xkey.sh
@@ -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 $?