aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan S. Arnold <ryan.arnold@linaro.org>2015-03-19 09:40:34 -0500
committerChristophe Lyon <christophe.lyon@linaro.org>2015-04-02 21:11:39 +0100
commit5a851de325264be7064eda790e2db4481afc373b (patch)
tree102eca637b2db37401228f24cb1b8fe00dfcfb69
parent37562281ee851c8d535f17daaaa29bfc6947fa31 (diff)
abe.sh: Error out on unknown --<foo> directives, invalid <foo>= components, and unknown commands.
[Linaro BZ 1372] https://bugs.linaro.org/show_bug.cgi?id=1372 This patch and accompanying abe/test.sh changes cause build failure when processing abe input commands under the following conditions: * Unsupported --<foo> directives will cause build failure. * Invalid <foo>= components will cause build failure. * Unknown commands <foo> (not directives or component specifiers) will cause build faiure. This solves the problem with --libc=<bar> being ignored and execution of abe progressing. Change-Id: Iad819f57e5f6ab575c68b6a63cfeb07a8bea3adf
-rwxr-xr-xabe.sh16
-rwxr-xr-xtest.sh30
2 files changed, 42 insertions, 4 deletions
diff --git a/abe.sh b/abe.sh
index 4471ea00..9b6f4b65 100755
--- a/abe.sh
+++ b/abe.sh
@@ -1039,6 +1039,13 @@ while test $# -gt 0; do
exit 0
;;
*)
+ # Look for unsupported -<foo> or --<foo> directives.
+ if test `echo $1 | grep -Ec "^-+"` -gt 0; then
+ error "${1}: Directive not supported. See ${abe} --help for supported options."
+ build_failure
+ fi
+
+ # Test for <foo>= specifiers
if test `echo $1 | grep -c =` -gt 0; then
name="`echo $1 | cut -d '=' -f 1`"
value="`echo $1 | cut -d '=' -f 2`"
@@ -1093,14 +1100,21 @@ while test $# -gt 0; do
newlib_version="${value}"
;;
*)
+ error "FIXME: Execution should never reach this point."
+ build_failure
;;
esac
;;
*)
+ # This will catch unsupported component specifiers like <foo>=
+ error "${name}: Component specified not supported. See ${abe} --help for supported components."
+ build_failure
;;
esac
else
- error "$1: Command not recognized."
+ # This will catch dangling words like <foo> that don't contain
+ # --<foo> and don't contain <foo>=
+ error "$1: Command not recognized. See ${abe} --help for supported options."
build_failure
fi
;;
diff --git a/test.sh b/test.sh
index 0d7309fb..b24bca18 100755
--- a/test.sh
+++ b/test.sh
@@ -251,19 +251,43 @@ match=''
test_pass "${cb_commands}" "${match}"
cb_commands="--dr"
-match="Command not recognized"
+match="Directive not supported"
test_failure "${cb_commands}" "${match}"
cb_commands="-dr"
-match="Command not recognized"
+match="Directive not supported"
test_failure "${cb_commands}" "${match}"
cb_commands="--drnasdfa"
-match="Command not recognized"
+match="Directive not supported"
test_failure "${cb_commands}" "${match}"
# Test for expected failure for removed deprecated feature --dostep.
cb_commands="--dostep"
+match="Directive not supported"
+test_failure "${cb_commands}" "${match}"
+
+# Test for expected failure for --libc=<foo>
+# https://bugs.linaro.org/show_bug.cgi?id=1372
+cb_commands="--libc"
+match="Directive not supported"
+test_failure "${cb_commands}" "${match}"
+
+# Test for expected failure for --libc=<foo>
+# https://bugs.linaro.org/show_bug.cgi?id=1372
+cb_commands="--libc="
+match="Directive not supported"
+test_failure "${cb_commands}" "${match}"
+
+# Test for expected failure for unknown toolchain component
+# https://bugs.linaro.org/show_bug.cgi?id=1372
+cb_commands="libc="
+match="Component specified not supported"
+test_failure "${cb_commands}" "${match}"
+
+# Test for non-directive dangling command
+# https://bugs.linaro.org/show_bug.cgi?id=1372
+cb_commands="libc"
match="Command not recognized"
test_failure "${cb_commands}" "${match}"