Improve output from make/cmake wrapper

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make
index 0c48696..257703e 100755
--- a/tests/scripts/quiet/make
+++ b/tests/scripts/quiet/make
@@ -18,13 +18,32 @@
 # Locate original tool
 ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 )
 
+quote_args() {
+    # similar to printf '%q' "$@"
+    # but produce more human-readable results for common/simple cases like "a b"
+    local args=("$@")
+    s=""
+    for a in "${args[@]}"; do
+        simple_pattern='^[[:alnum:] _=+-]*$'
+        if [[ $a =~ ' ' && $a =~ $simple_pattern ]]; then
+            # a has spaces, but no other special characters that need escaping
+            # (quoting after removing spaces yields no backslashes)
+            # simplify quoted form to "$a" - e.g. yield "a b c" instead of a\ b\ c
+            q="\"$a\""
+        else
+            # get bash to do the quoting
+            q=$(printf '%q' "$a")
+        fi
+        s="$s $q"
+    done
+    echo $s
+}
+
 if [[ ! " $@ " =~ " --version " ]]; then
     # Display the command being invoked - if it succeeds, this is all that will
     # be displayed. Don't do this for invocations with --version, because
     # this output is often parsed by scripts, so we don't want to modify it.
-    echo -n "${TOOL} "
-    printf '%q ' "$@"
-    echo
+    echo "${TOOL} $(quote_args "$@")"
 fi
 
 if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then