diff options
author | Andrew Donnellan <andrew.donnellan@au1.ibm.com> | 2015-07-30 15:59:49 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-31 15:32:43 +1000 |
commit | edae9f7463b8a7129e0caaaec8912a2f16cba62b (patch) | |
tree | dcbe30870cd18901730615fac9034c7ba4f4e071 /external/boot-tests | |
parent | 4f6919b098f14a5f744b8ad3f0e66eb5ca4e5860 (diff) | |
download | talos-skiboot-edae9f7463b8a7129e0caaaec8912a2f16cba62b.tar.gz talos-skiboot-edae9f7463b8a7129e0caaaec8912a2f16cba62b.zip |
external/boot-tests: Fix logging functions in boot_test.sh
Fix the error() and msg() functions in boot_test.sh so they don't cause a
shell error when called before $target is set (i.e. before parameter
parsing).
Change error() to allow the use of multiple arguments in the message, in
line with msg(). Use $* rather than $@ as it's very slightly more correct.
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/boot-tests')
-rwxr-xr-x | external/boot-tests/boot_test.sh | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/external/boot-tests/boot_test.sh b/external/boot-tests/boot_test.sh index b7f14e48..303f78eb 100755 --- a/external/boot-tests/boot_test.sh +++ b/external/boot-tests/boot_test.sh @@ -5,6 +5,7 @@ set -uo pipefail V=0; +target="" if [ -f ~/.skiboot_boot_tests ]; then source ~/.skiboot_boot_tests @@ -12,14 +13,23 @@ fi # Utility functions function error { - unset SSHPASS; - echo "$target: $1" >&2; - exit 1; + unset SSHPASS + if [ ! -z "$target" ]; then + echo "$target: $*" >&2 + else + echo "$0: $*" >&2 + fi + + exit 1 } function msg { - if [ $V -ne 0 ] ; then - echo "$target: $@"; + if [ $V -ne 0 ]; then + if [ ! -z "$target" ]; then + echo "$target: $*" + else + echo "$0: $*" + fi fi } |