aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb62281@gmail.com>2018-12-21 19:45:48 +1100
committerBen Elliston <bje@gnu.org>2018-12-21 19:45:48 +1100
commit04efb47225767928e7bc69036d489572d6e255d2 (patch)
treee8b370172bf9690234a2f4c25da266f1dffd69bc
parentf037566a76a4fa5861b8eff39427e66c2f016649 (diff)
downloaddejagnu-04efb47225767928e7bc69036d489572d6e255d2.zip
dejagnu-04efb47225767928e7bc69036d489572d6e255d2.tar.gz
dejagnu-04efb47225767928e7bc69036d489572d6e255d2.tar.bz2
PR 33817
* dejagnu: Improve command parsing to fix bug. Previously, the documented equivalence between "multi word command" and "multi-word-command" did not hold if no arguments were given. * testsuite/launcher.all/command.exp: Add tests. Signed-off-by: Ben Elliston <bje@gnu.org>
-rw-r--r--ChangeLog8
-rwxr-xr-xdejagnu14
-rw-r--r--testsuite/launcher.all/command.exp9
3 files changed, 26 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 920d201..658ec58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-12-21 Jacob Bachmeyer <jcb62281@gmail.com>
+
+ PR 33817
+ * dejagnu: Improve command parsing to fix bug. Previously, the
+ documented equivalence between "multi word command" and
+ "multi-word-command" did not hold if no arguments were given.
+ * testsuite/launcher.all/command.exp: Add tests.
+
2018-12-20 Ben Elliston <bje@gnu.org>
* NEWS: Add item for new dejagnu command.
diff --git a/dejagnu b/dejagnu
index 06efcc7..6cd52f6 100755
--- a/dejagnu
+++ b/dejagnu
@@ -134,7 +134,6 @@ fi
# Remove any leading autoconf platform prefix and the "dejagnu" prefix.
command="$(basename "$0" | sed -e 's/^.*-\?dejagnu-\?//')"
-commext=
while expr $# \> 0 > /dev/null
do
@@ -151,15 +150,12 @@ do
for ext in ${Variants}
do
if test -f "${commdir}/${command}.$ext" ; then
- commext="$commext $ext"
+ break 2
fi
done
if expr "$1" : - > /dev/null ; then
break
fi
- if test -n "$commext" ; then
- break
- fi
if test -n "$1" ; then
command="${command}-$1"
shift
@@ -168,6 +164,14 @@ do
fi
done
+commext=
+for ext in ${Variants}
+do
+ if test -f "${commdir}/${command}.$ext" ; then
+ commext="$commext $ext"
+ fi
+done
+
if test -z "$commext" && test -n "$command" ; then
echo ERROR: could not resolve command "$command"
exit 2
diff --git a/testsuite/launcher.all/command.exp b/testsuite/launcher.all/command.exp
index eb7b219..9e21237 100644
--- a/testsuite/launcher.all/command.exp
+++ b/testsuite/launcher.all/command.exp
@@ -70,6 +70,15 @@ set tests {
"Found subcommand baz-quux with variants: gawk\n"
"Selected variant gawk" }
+ { "#" "bug #33817: ensure that the failure is 'no variant'"
+ " rather than 'could not resolve command'" }
+ { "dejagnu baz-quux is resolved but fails without GNU Awk (bug #33817)"
+ {baz-quux} {GAWK=bogus} 2
+ "ERROR: no variant of baz-quux was selected" }
+ { "dejagnu baz quux is resolved but fails without GNU Awk (bug #33817)"
+ {baz quux} {GAWK=bogus} 2
+ "ERROR: no variant of baz-quux was selected" }
+
{ "#" invalid direct calls }
{ "dejagnu -v bar fails" {-v bar} {} 2