test: Minor refactor to allow $EXEEXT in program names
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
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 $?