test-all: Fix shellcheck warnings.

In tools/test-all line 7:
TEMP=`getopt -o f --long force -- "$@"`
     ^-- SC2006: Use $(..) instead of legacy `..`.

In tools/test-all line 24:
    echo "Running $@"
                  ^-- SC2145: Argument mixes string and array. Use * or separate argument.

In tools/test-all line 26:
        printf "\n\e[31;1mFAILED\e[0m $@\n"
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                ^-- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n".
                  ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".
                                ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".
                                      ^-- SC2145: Argument mixes string and array. Use * or separate argument.
                                        ^-- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n".

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-03 00:14:50 +00:00 committed by Tim Abbott
parent e9656564c2
commit c93f53b463
1 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")"/..
# read the options
TEMP=`getopt -o f --long force -- "$@"`
TEMP=$(getopt -o f --long force -- "$@")
eval set -- "$TEMP"
# extract options.
@ -21,9 +21,13 @@ done
function run {
echo '----'
echo "Running $@"
printf 'Running'
printf ' %q' "$@"
printf '\n'
if ! "$@"; then
printf "\n\e[31;1mFAILED\e[0m $@\n"
printf '\n\e[31;1mFAILED\e[0m'
printf ' %q' "$@"
printf '\n'
exit 1
else
echo