diff options
author | Ryan S. Arnold <ryan.arnold@linaro.org> | 2015-03-19 09:40:34 -0500 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2015-04-02 21:11:39 +0100 |
commit | 5a851de325264be7064eda790e2db4481afc373b (patch) | |
tree | 102eca637b2db37401228f24cb1b8fe00dfcfb69 | |
parent | 37562281ee851c8d535f17daaaa29bfc6947fa31 (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-x | abe.sh | 16 | ||||
-rwxr-xr-x | test.sh | 30 |
2 files changed, 42 insertions, 4 deletions
@@ -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 ;; @@ -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}" |