From 3e2c61dca2cb27c54f33ab1591802d8961a97f59 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 4 Jan 2024 16:20:20 +0000 Subject: [PATCH 01/27] Create quiet wrappers for make and cmake Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 44 +++++++++++++++++++++++++++++++++++++++ tests/scripts/quiet/make | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100755 tests/scripts/quiet/cmake create mode 100755 tests/scripts/quiet/make diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake new file mode 100755 index 0000000000..ea1474f877 --- /dev/null +++ b/tests/scripts/quiet/cmake @@ -0,0 +1,44 @@ +#! /usr/bin/env bash +# +# Copyright The Mbed TLS Contributors +# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +# +# This swallows the output of the wrapped tool, unless there is an error. +# This helps reduce excess logging in the CI. + +# If you are debugging a build / CI issue, you can get complete unsilenced logs +# by un-commenting the following line (or setting VERBOSE_LOGS in your environment): +# VERBOSE_LOGS=1 + +# don't silence invocations containing these arguments +NO_SILENCE=" --version " + +TOOL=$(basename "$0") + +# Locate original tool +ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 ) + +if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then + ${ORIGINAL_TOOL} "$@" + EXIT_STATUS=$? +else + # Display the command being invoked - if it succeeds, this is all that will + # be displayed. + echo "${TOOL} $@" + + # Run original command and capture output & exit status + TMPFILE=$(mktemp /tmp/quiet-${TOOL}.XXXXXX) + ${ORIGINAL_TOOL} "$@" > ${TMPFILE} 2>&1 + EXIT_STATUS=$? + + if [[ $EXIT_STATUS -ne 0 ]]; then + # On error, display the full output + cat ${TMPFILE} + fi + + # Remove tmpfile + rm ${TMPFILE} +fi + +# Propagate the exit status +exit $EXIT_STATUS diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make new file mode 100755 index 0000000000..633758ae6f --- /dev/null +++ b/tests/scripts/quiet/make @@ -0,0 +1,44 @@ +#! /usr/bin/env bash +# +# Copyright The Mbed TLS Contributors +# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +# +# This swallows the output of the wrapped tool, unless there is an error. +# This helps reduce excess logging in the CI. + +# If you are debugging a build / CI issue, you can get complete unsilenced logs +# by un-commenting the following line (or setting VERBOSE_LOGS in your environment): +# VERBOSE_LOGS=1 + +# don't silence invocations containing these arguments +NO_SILENCE=" --version | test " + +TOOL=$(basename "$0") + +# Locate original tool +ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 ) + +if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then + ${ORIGINAL_TOOL} "$@" + EXIT_STATUS=$? +else + # Display the command being invoked - if it succeeds, this is all that will + # be displayed. + echo "${TOOL} $@" + + # Run original command and capture output & exit status + TMPFILE=$(mktemp /tmp/quiet-${TOOL}.XXXXXX) + ${ORIGINAL_TOOL} "$@" > ${TMPFILE} 2>&1 + EXIT_STATUS=$? + + if [[ $EXIT_STATUS -ne 0 ]]; then + # On error, display the full output + cat ${TMPFILE} + fi + + # Remove tmpfile + rm ${TMPFILE} +fi + +# Propagate the exit status +exit $EXIT_STATUS From ad4b70586353411a9853bfcbe2967e3e60fe39a6 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 16 Jan 2024 17:33:27 +0000 Subject: [PATCH 02/27] Use quiet make wrappers from all.sh Signed-off-by: Dave Rodgman --- tests/scripts/all.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 44930d28b5..9274c7b1fe 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -131,6 +131,25 @@ pre_check_environment () { } pre_initialize_variables () { + special_options="--list-components|--list-all-components|-h|--help" + if [[ ! "$@" =~ $special_options ]]; then + # skip wrappers for "special options" which don't actually run any tests + + # Pick up "quiet" wrappers for make and cmake, which don't output very much + # unless there is an error. This reduces logging overhead in the CI. + # + # Note that the cmake wrapper breaks unless we use an absolute path here. + export PATH=${PWD}/tests/scripts/quiet:$PATH + if [[ ! -x ${PWD}/tests/scripts/quiet/make ]]; then + echo "can't find quiet/make" + exit 1 + fi + if [[ ! -x ${PWD}/tests/scripts/quiet/cmake ]]; then + echo "can't find quiet/cmake" + exit 1 + fi + fi + if in_mbedtls_repo; then CONFIG_H='include/mbedtls/mbedtls_config.h' else @@ -6246,7 +6265,7 @@ run_component () { # Preliminary setup pre_check_environment -pre_initialize_variables +pre_initialize_variables "$@" pre_parse_command_line "$@" pre_check_git From 5f8e2a2b5faca5790bc06aefc21ea0d50d9bbee2 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 16 Jan 2024 17:33:34 +0000 Subject: [PATCH 03/27] Spelling fix Signed-off-by: Dave Rodgman --- tests/scripts/all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 9274c7b1fe..1694ee954d 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -231,7 +231,7 @@ pre_initialize_variables () { # defined in this script whose name starts with "component_". ALL_COMPONENTS=$(compgen -A function component_ | sed 's/component_//') - # Delay determinig SUPPORTED_COMPONENTS until the command line options have a chance to override + # Delay determining SUPPORTED_COMPONENTS until the command line options have a chance to override # the commands set by the environment } From 5c745fa7dae42759d2e0d095d4a2edb21784de14 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Wed, 17 Jan 2024 09:59:10 +0000 Subject: [PATCH 04/27] Pacify check_files Signed-off-by: Dave Rodgman --- tests/scripts/check_files.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/scripts/check_files.py b/tests/scripts/check_files.py index 65fbc9f070..4483f55737 100755 --- a/tests/scripts/check_files.py +++ b/tests/scripts/check_files.py @@ -173,6 +173,8 @@ class ShebangIssueTracker(FileIssueTracker): b'sh': 'sh', } + path_exemptions = re.compile(r'tests/scripts/quiet/.*') + def is_valid_shebang(self, first_line, filepath): m = re.match(self._shebang_re, first_line) if not m: From 0fa6b362574ac657de16443d70d0a638106f6ef1 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 15 Feb 2024 12:27:03 +0000 Subject: [PATCH 05/27] Always display make/cmake invocation command Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 14 ++++++++++---- tests/scripts/quiet/make | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index ea1474f877..2e95c6b938 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -18,14 +18,20 @@ TOOL=$(basename "$0") # Locate original tool ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 ) +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 +fi + if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then + # Run original command with no output supression ${ORIGINAL_TOOL} "$@" EXIT_STATUS=$? else - # Display the command being invoked - if it succeeds, this is all that will - # be displayed. - echo "${TOOL} $@" - # Run original command and capture output & exit status TMPFILE=$(mktemp /tmp/quiet-${TOOL}.XXXXXX) ${ORIGINAL_TOOL} "$@" > ${TMPFILE} 2>&1 diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 633758ae6f..0c4869644e 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -18,14 +18,20 @@ TOOL=$(basename "$0") # Locate original tool ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 ) +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 +fi + if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then + # Run original command with no output supression ${ORIGINAL_TOOL} "$@" EXIT_STATUS=$? else - # Display the command being invoked - if it succeeds, this is all that will - # be displayed. - echo "${TOOL} $@" - # Run original command and capture output & exit status TMPFILE=$(mktemp /tmp/quiet-${TOOL}.XXXXXX) ${ORIGINAL_TOOL} "$@" > ${TMPFILE} 2>&1 From 90dbba5385f7e0eafa23648fd7aed2de9b524c4f Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 15 Feb 2024 14:39:48 +0000 Subject: [PATCH 06/27] Improve output from make/cmake wrapper Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 25 ++++++++++++++++++++++--- tests/scripts/quiet/make | 25 ++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index 2e95c6b938..e3114a86fc 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -18,13 +18,32 @@ TOOL=$(basename "$0") # 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 diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 0c4869644e..257703ec93 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -18,13 +18,32 @@ TOOL=$(basename "$0") # 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 From 1110698ed9b59bf3ff3e0c5da3c189262f626b37 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 15 Feb 2024 16:04:36 +0000 Subject: [PATCH 07/27] Improve quote_args output readability Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 8 +++++--- tests/scripts/quiet/make | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index e3114a86fc..a79d7578bf 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -24,12 +24,14 @@ quote_args() { local args=("$@") s="" for a in "${args[@]}"; do - simple_pattern='^[[:alnum:] _=+-]*$' + simple_pattern='^([[:alnum:]_+-]+=)?([[: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\"" + # simplify quoted form - e.g.: + # a b -> "a b" + # CFLAGS=a b -> CFLAGS="a b" + q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" else # get bash to do the quoting q=$(printf '%q' "$a") diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 257703ec93..9722029083 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -24,12 +24,14 @@ quote_args() { local args=("$@") s="" for a in "${args[@]}"; do - simple_pattern='^[[:alnum:] _=+-]*$' + simple_pattern='^([[:alnum:]_+-]+=)?([[: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\"" + # simplify quoted form - e.g.: + # a b -> "a b" + # CFLAGS=a b -> CFLAGS="a b" + q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" else # get bash to do the quoting q=$(printf '%q' "$a") From 219006329da09f0c0821a34935953efc4d397c8f Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 11:41:19 +0000 Subject: [PATCH 08/27] Move quiet wrapper setup Signed-off-by: Dave Rodgman --- tests/scripts/all.sh | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 1694ee954d..54917d32e6 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -131,25 +131,6 @@ pre_check_environment () { } pre_initialize_variables () { - special_options="--list-components|--list-all-components|-h|--help" - if [[ ! "$@" =~ $special_options ]]; then - # skip wrappers for "special options" which don't actually run any tests - - # Pick up "quiet" wrappers for make and cmake, which don't output very much - # unless there is an error. This reduces logging overhead in the CI. - # - # Note that the cmake wrapper breaks unless we use an absolute path here. - export PATH=${PWD}/tests/scripts/quiet:$PATH - if [[ ! -x ${PWD}/tests/scripts/quiet/make ]]; then - echo "can't find quiet/make" - exit 1 - fi - if [[ ! -x ${PWD}/tests/scripts/quiet/cmake ]]; then - echo "can't find quiet/cmake" - exit 1 - fi - fi - if in_mbedtls_repo; then CONFIG_H='include/mbedtls/mbedtls_config.h' else @@ -235,6 +216,23 @@ pre_initialize_variables () { # the commands set by the environment } +setup_quiet_wrappers() +{ + # Pick up "quiet" wrappers for make and cmake, which don't output very much + # unless there is an error. This reduces logging overhead in the CI. + # + # Note that the cmake wrapper breaks unless we use an absolute path here. + export PATH=${PWD}/tests/scripts/quiet:$PATH + if [[ ! -x ${PWD}/tests/scripts/quiet/make ]]; then + echo "can't find quiet/make" + exit 1 + fi + if [[ ! -x ${PWD}/tests/scripts/quiet/cmake ]]; then + echo "can't find quiet/cmake" + exit 1 + fi +} + # Test whether the component $1 is included in the command line patterns. is_component_included() { @@ -6268,6 +6266,7 @@ pre_check_environment pre_initialize_variables "$@" pre_parse_command_line "$@" +setup_quiet_wrappers pre_check_git pre_restore_files pre_back_up From 00bc790d79eb2d8ef3f0e1e2d3a67cfb1b8547c7 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 11:43:11 +0000 Subject: [PATCH 09/27] Tidy up quiet wrappers Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 39 ++++++++++++++++++------------------- tests/scripts/quiet/make | 41 +++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index a79d7578bf..4804637f8e 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -16,15 +16,13 @@ NO_SILENCE=" --version " TOOL=$(basename "$0") # Locate original tool -ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 ) +ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$0" | head -n1 ) -quote_args() { +print_quoted_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:]_+-]+=)?([[:alnum:] _=+-]*)$' + for a in "$@"; do + simple_pattern='^([[:alnum:]_+-]+=)?([[: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) @@ -33,39 +31,40 @@ quote_args() { # CFLAGS=a b -> CFLAGS="a b" q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" else - # get bash to do the quoting + # get bash to do the quoting (which may result in no quotes or escaping, + # if none is needed). q=$(printf '%q' "$a") fi - s="$s $q" + printf "%s " "$q" done - echo $s } -if [[ ! " $@ " =~ " --version " ]]; then +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 "${TOOL} $(quote_args "$@")" + printf %s "${TOOL} " + print_quoted_args "$@" + echo fi if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then # Run original command with no output supression - ${ORIGINAL_TOOL} "$@" - EXIT_STATUS=$? + exec "${ORIGINAL_TOOL}" "$@" else # Run original command and capture output & exit status - TMPFILE=$(mktemp /tmp/quiet-${TOOL}.XXXXXX) - ${ORIGINAL_TOOL} "$@" > ${TMPFILE} 2>&1 + TMPFILE=$(mktemp "quiet-${TOOL}.XXXXXX") + "${ORIGINAL_TOOL}" "$@" > "${TMPFILE}" 2>&1 EXIT_STATUS=$? if [[ $EXIT_STATUS -ne 0 ]]; then # On error, display the full output - cat ${TMPFILE} + cat "${TMPFILE}" fi # Remove tmpfile - rm ${TMPFILE} -fi + rm "${TMPFILE}" -# Propagate the exit status -exit $EXIT_STATUS + # Propagate the exit status + exit $EXIT_STATUS +fi diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 9722029083..3eae91c4f0 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -11,20 +11,18 @@ # VERBOSE_LOGS=1 # don't silence invocations containing these arguments -NO_SILENCE=" --version | test " +NO_SILENCE=" --version | test" TOOL=$(basename "$0") # Locate original tool -ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 ) +ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$0" | head -n1 ) -quote_args() { +print_quoted_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:]_+-]+=)?([[:alnum:] _=+-]*)$' + for a in "$@"; do + simple_pattern='^([[:alnum:]_+-]+=)?([[: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) @@ -33,39 +31,40 @@ quote_args() { # CFLAGS=a b -> CFLAGS="a b" q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" else - # get bash to do the quoting + # get bash to do the quoting (which may result in no quotes or escaping, + # if none is needed). q=$(printf '%q' "$a") fi - s="$s $q" + printf "%s " "$q" done - echo $s } -if [[ ! " $@ " =~ " --version " ]]; then +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 "${TOOL} $(quote_args "$@")" + printf %s "${TOOL} " + print_quoted_args "$@" + echo fi if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then # Run original command with no output supression - ${ORIGINAL_TOOL} "$@" - EXIT_STATUS=$? + exec "${ORIGINAL_TOOL}" "$@" else # Run original command and capture output & exit status - TMPFILE=$(mktemp /tmp/quiet-${TOOL}.XXXXXX) - ${ORIGINAL_TOOL} "$@" > ${TMPFILE} 2>&1 + TMPFILE=$(mktemp "quiet-${TOOL}.XXXXXX") + "${ORIGINAL_TOOL}" "$@" > "${TMPFILE}" 2>&1 EXIT_STATUS=$? if [[ $EXIT_STATUS -ne 0 ]]; then # On error, display the full output - cat ${TMPFILE} + cat "${TMPFILE}" fi # Remove tmpfile - rm ${TMPFILE} -fi + rm "${TMPFILE}" -# Propagate the exit status -exit $EXIT_STATUS + # Propagate the exit status + exit $EXIT_STATUS +fi From 98a79cdb238ee6b1b83167b2ce8aba9b6ffd13dd Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 12:37:44 +0000 Subject: [PATCH 10/27] Extract common parts of quiet wrapper Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 58 ++-------------------------------- tests/scripts/quiet/make | 58 ++-------------------------------- tests/scripts/quiet/quiet | 65 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 110 deletions(-) create mode 100755 tests/scripts/quiet/quiet diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index 4804637f8e..10a0b25f43 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -11,60 +11,8 @@ # VERBOSE_LOGS=1 # don't silence invocations containing these arguments -NO_SILENCE=" --version " +export NO_SILENCE=" --version " -TOOL=$(basename "$0") +export TOOL="cmake" -# Locate original tool -ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$0" | head -n1 ) - -print_quoted_args() { - # similar to printf '%q' "$@" - # but produce more human-readable results for common/simple cases like "a b" - for a in "$@"; do - simple_pattern='^([[:alnum:]_+-]+=)?([[: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 - e.g.: - # a b -> "a b" - # CFLAGS=a b -> CFLAGS="a b" - q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" - else - # get bash to do the quoting (which may result in no quotes or escaping, - # if none is needed). - q=$(printf '%q' "$a") - fi - printf "%s " "$q" - done -} - -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. - printf %s "${TOOL} " - print_quoted_args "$@" - echo -fi - -if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then - # Run original command with no output supression - exec "${ORIGINAL_TOOL}" "$@" -else - # Run original command and capture output & exit status - TMPFILE=$(mktemp "quiet-${TOOL}.XXXXXX") - "${ORIGINAL_TOOL}" "$@" > "${TMPFILE}" 2>&1 - EXIT_STATUS=$? - - if [[ $EXIT_STATUS -ne 0 ]]; then - # On error, display the full output - cat "${TMPFILE}" - fi - - # Remove tmpfile - rm "${TMPFILE}" - - # Propagate the exit status - exit $EXIT_STATUS -fi +exec $(dirname "$0")/quiet "$@" diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 3eae91c4f0..a1ef3e565d 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -11,60 +11,8 @@ # VERBOSE_LOGS=1 # don't silence invocations containing these arguments -NO_SILENCE=" --version | test" +export NO_SILENCE=" --version | test " -TOOL=$(basename "$0") +export TOOL="make" -# Locate original tool -ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$0" | head -n1 ) - -print_quoted_args() { - # similar to printf '%q' "$@" - # but produce more human-readable results for common/simple cases like "a b" - for a in "$@"; do - simple_pattern='^([[:alnum:]_+-]+=)?([[: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 - e.g.: - # a b -> "a b" - # CFLAGS=a b -> CFLAGS="a b" - q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" - else - # get bash to do the quoting (which may result in no quotes or escaping, - # if none is needed). - q=$(printf '%q' "$a") - fi - printf "%s " "$q" - done -} - -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. - printf %s "${TOOL} " - print_quoted_args "$@" - echo -fi - -if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then - # Run original command with no output supression - exec "${ORIGINAL_TOOL}" "$@" -else - # Run original command and capture output & exit status - TMPFILE=$(mktemp "quiet-${TOOL}.XXXXXX") - "${ORIGINAL_TOOL}" "$@" > "${TMPFILE}" 2>&1 - EXIT_STATUS=$? - - if [[ $EXIT_STATUS -ne 0 ]]; then - # On error, display the full output - cat "${TMPFILE}" - fi - - # Remove tmpfile - rm "${TMPFILE}" - - # Propagate the exit status - exit $EXIT_STATUS -fi +exec $(dirname "$0")/quiet "$@" diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet new file mode 100755 index 0000000000..2279e6a717 --- /dev/null +++ b/tests/scripts/quiet/quiet @@ -0,0 +1,65 @@ +#! /usr/bin/env bash +# +# Copyright The Mbed TLS Contributors +# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +# +# This swallows the output of the wrapped tool, unless there is an error. +# This helps reduce excess logging in the CI. + +# If you are debugging a build / CI issue, you can get complete unsilenced logs +# by un-commenting the following line (or setting VERBOSE_LOGS in your environment): +# VERBOSE_LOGS=1 + +# Locate original tool +ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$0" | head -n1) + +print_quoted_args() { + # similar to printf '%q' "$@" + # but produce more human-readable results for common/simple cases like "a b" + for a in "$@"; do + simple_pattern='^([[:alnum:]_+-]+=)?([[: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 - e.g.: + # a b -> "a b" + # CFLAGS=a b -> CFLAGS="a b" + q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" + else + # get bash to do the quoting (which may result in no quotes or escaping, + # if none is needed). + q=$(printf '%q' "$a") + fi + printf "%s " "$q" + done +} + +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. + printf %s "${TOOL} " + print_quoted_args "$@" + echo +fi + +if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then + # Run original command with no output supression + exec "${ORIGINAL_TOOL}" "$@" +else + # Run original command and capture output & exit status + TMPFILE=$(mktemp "quiet-${TOOL}.XXXXXX") + "${ORIGINAL_TOOL}" "$@" > "${TMPFILE}" 2>&1 + EXIT_STATUS=$? + + if [[ $EXIT_STATUS -ne 0 ]]; then + # On error, display the full output + cat "${TMPFILE}" + fi + + # Remove tmpfile + rm "${TMPFILE}" + + # Propagate the exit status + exit $EXIT_STATUS +fi From e03088b29eab0ba6cd0c40fb19ef5fd5904730e6 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 12:48:49 +0000 Subject: [PATCH 11/27] Avoid infinite loop Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet index 2279e6a717..bbc685cd8b 100755 --- a/tests/scripts/quiet/quiet +++ b/tests/scripts/quiet/quiet @@ -11,7 +11,8 @@ # VERBOSE_LOGS=1 # Locate original tool -ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$0" | head -n1) +TOOL_WITH_PATH=$(dirname "$0")/$TOOL +ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$TOOL_WITH_PATH" | head -n1) print_quoted_args() { # similar to printf '%q' "$@" From a9e8dbed14d487503d74cceb39df4e5f92ad06b7 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:27:18 +0000 Subject: [PATCH 12/27] Allow wrappers to be missing; quote directory name from make Co-authored-by: Gilles Peskine Signed-off-by: Dave Rodgman --- tests/scripts/all.sh | 10 ++-------- tests/scripts/quiet/make | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 54917d32e6..a8a704c080 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -222,14 +222,8 @@ setup_quiet_wrappers() # unless there is an error. This reduces logging overhead in the CI. # # Note that the cmake wrapper breaks unless we use an absolute path here. - export PATH=${PWD}/tests/scripts/quiet:$PATH - if [[ ! -x ${PWD}/tests/scripts/quiet/make ]]; then - echo "can't find quiet/make" - exit 1 - fi - if [[ ! -x ${PWD}/tests/scripts/quiet/cmake ]]; then - echo "can't find quiet/cmake" - exit 1 + if [[ -e ${PWD}/tests/scripts/quiet ]]; then + export PATH=${PWD}/tests/scripts/quiet:$PATH fi } diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index a1ef3e565d..162d44de6c 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -15,4 +15,4 @@ export NO_SILENCE=" --version | test " export TOOL="make" -exec $(dirname "$0")/quiet "$@" +exec "$(dirname "$0")/quiet" "$@" From 30483dccc0df41bacb3ed38c682614666903fd95 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:28:13 +0000 Subject: [PATCH 13/27] Undo not-needed change Signed-off-by: Dave Rodgman --- tests/scripts/all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index a8a704c080..ec201ce3c2 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -6257,7 +6257,7 @@ run_component () { # Preliminary setup pre_check_environment -pre_initialize_variables "$@" +pre_initialize_variables pre_parse_command_line "$@" setup_quiet_wrappers From c7f05490bb804569b43aca1bbafa2596b49a42ae Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:28:42 +0000 Subject: [PATCH 14/27] Quote directory name from cmake wrapper Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index 10a0b25f43..3723473f53 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -15,4 +15,4 @@ export NO_SILENCE=" --version " export TOOL="cmake" -exec $(dirname "$0")/quiet "$@" +exec "$(dirname "$0")/quiet" "$@" From d0e3827ea2020c4a7a870cf759fed254c79c1c5d Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:28:56 +0000 Subject: [PATCH 15/27] Improve docs Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet index bbc685cd8b..8f83d07638 100755 --- a/tests/scripts/quiet/quiet +++ b/tests/scripts/quiet/quiet @@ -9,6 +9,17 @@ # If you are debugging a build / CI issue, you can get complete unsilenced logs # by un-commenting the following line (or setting VERBOSE_LOGS in your environment): # VERBOSE_LOGS=1 +# +# This script provides most of the functionality for the adjacent make and cmake +# wrappers. +# +# It requires two variables to be set: +# +# TOOL - the name of the tool that is being wrapped (with no path), e.g. "make" +# +# NO_SILENCE - a regex that describes the commandline arguments for which output will not +# be silenced, e.g. " --version | test ". In this example, "make test" will +# not be silent, but "make lib" will be. # Locate original tool TOOL_WITH_PATH=$(dirname "$0")/$TOOL From bdf0a6d4318fe19b8a61d573b334ff447fa8bc66 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:29:10 +0000 Subject: [PATCH 16/27] remove shebang from quiet Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet index 8f83d07638..00e2f6342f 100755 --- a/tests/scripts/quiet/quiet +++ b/tests/scripts/quiet/quiet @@ -1,5 +1,3 @@ -#! /usr/bin/env bash -# # Copyright The Mbed TLS Contributors # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # From dbc2e8d4ccad4ac7da8a27c34253a74bad34d20a Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:29:31 +0000 Subject: [PATCH 17/27] Improve simplified quoting Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet index 00e2f6342f..7b54bdba86 100755 --- a/tests/scripts/quiet/quiet +++ b/tests/scripts/quiet/quiet @@ -27,18 +27,15 @@ print_quoted_args() { # similar to printf '%q' "$@" # but produce more human-readable results for common/simple cases like "a b" for a in "$@"; do - simple_pattern='^([[:alnum:]_+-]+=)?([[: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 - e.g.: - # a b -> "a b" - # CFLAGS=a b -> CFLAGS="a b" - q="${BASH_REMATCH[1]}\"${BASH_REMATCH[2]}\"" - else - # get bash to do the quoting (which may result in no quotes or escaping, - # if none is needed). - q=$(printf '%q' "$a") + # Get bash to quote the string + q=$(printf '%q' "$a") + simple_pattern="^([-[:alnum:]_+./:@]+=)?([^']*)$" + if [[ "$a" != "$q" && $a =~ $simple_pattern ]]; then + # a requires some quoting (a != q), but has no single quotes, so we can + # simplify the quoted form - e.g.: + # a b -> 'a b' + # CFLAGS=a b -> CFLAGS='a b' + q="${BASH_REMATCH[1]}'${BASH_REMATCH[2]}'" fi printf "%s " "$q" done From 67126bbcea0f0486149ba3f8671a12e747924ceb Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:30:37 +0000 Subject: [PATCH 18/27] remove trailing space from printed command Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet index 7b54bdba86..9c4939ed24 100755 --- a/tests/scripts/quiet/quiet +++ b/tests/scripts/quiet/quiet @@ -37,7 +37,7 @@ print_quoted_args() { # CFLAGS=a b -> CFLAGS='a b' q="${BASH_REMATCH[1]}'${BASH_REMATCH[2]}'" fi - printf "%s " "$q" + printf " %s" "$q" done } @@ -45,7 +45,7 @@ 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. - printf %s "${TOOL} " + printf %s "${TOOL}" print_quoted_args "$@" echo fi From 2f94766a613500b6cdf79f2a438eef7faa975f2a Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 26 Feb 2024 17:30:56 +0000 Subject: [PATCH 19/27] Send printed command to stderr Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet index 9c4939ed24..0f5bf06ecd 100755 --- a/tests/scripts/quiet/quiet +++ b/tests/scripts/quiet/quiet @@ -45,9 +45,9 @@ 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. - printf %s "${TOOL}" - print_quoted_args "$@" - echo + printf %s "${TOOL}" 1>&2 + print_quoted_args "$@" 1>&2 + echo 1>&2 fi if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then From 1f08a3248e201146c6a8f0bcba99647b37516e99 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 14:00:58 +0000 Subject: [PATCH 20/27] Rename quiet to quiet.sh Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 2 +- tests/scripts/quiet/make | 2 +- tests/scripts/quiet/{quiet => quiet.sh} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/scripts/quiet/{quiet => quiet.sh} (100%) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index 3723473f53..586397887f 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -15,4 +15,4 @@ export NO_SILENCE=" --version " export TOOL="cmake" -exec "$(dirname "$0")/quiet" "$@" +exec "$(dirname "$0")/quiet.sh" "$@" diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 162d44de6c..24e77951c2 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -15,4 +15,4 @@ export NO_SILENCE=" --version | test " export TOOL="make" -exec "$(dirname "$0")/quiet" "$@" +exec "$(dirname "$0")/quiet.sh" "$@" diff --git a/tests/scripts/quiet/quiet b/tests/scripts/quiet/quiet.sh similarity index 100% rename from tests/scripts/quiet/quiet rename to tests/scripts/quiet/quiet.sh From 20964780347fcde5916cf2cd625049d587fba572 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 14:06:19 +0000 Subject: [PATCH 21/27] Add editor hint for emacs Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/scripts/quiet/quiet.sh b/tests/scripts/quiet/quiet.sh index 0f5bf06ecd..be065f4d78 100755 --- a/tests/scripts/quiet/quiet.sh +++ b/tests/scripts/quiet/quiet.sh @@ -1,3 +1,5 @@ +# -*-mode: sh; sh-shell: bash -*- +# # Copyright The Mbed TLS Contributors # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # From 63c94a36f19ceaf0f410ac5ca4f51f40dade8642 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 14:06:36 +0000 Subject: [PATCH 22/27] improve docs Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/quiet/quiet.sh b/tests/scripts/quiet/quiet.sh index be065f4d78..5cdcd1ea64 100755 --- a/tests/scripts/quiet/quiet.sh +++ b/tests/scripts/quiet/quiet.sh @@ -19,7 +19,7 @@ # # NO_SILENCE - a regex that describes the commandline arguments for which output will not # be silenced, e.g. " --version | test ". In this example, "make test" will -# not be silent, but "make lib" will be. +# not be silent, but "make lib test" will be. # Locate original tool TOOL_WITH_PATH=$(dirname "$0")/$TOOL From a3e694c2ad0d915b545874b7ba3a0829997306e6 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 14:06:49 +0000 Subject: [PATCH 23/27] simplify printf call Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/quiet/quiet.sh b/tests/scripts/quiet/quiet.sh index 5cdcd1ea64..5b341294f7 100755 --- a/tests/scripts/quiet/quiet.sh +++ b/tests/scripts/quiet/quiet.sh @@ -30,7 +30,7 @@ print_quoted_args() { # but produce more human-readable results for common/simple cases like "a b" for a in "$@"; do # Get bash to quote the string - q=$(printf '%q' "$a") + printf -v q '%q' "$a" simple_pattern="^([-[:alnum:]_+./:@]+=)?([^']*)$" if [[ "$a" != "$q" && $a =~ $simple_pattern ]]; then # a requires some quoting (a != q), but has no single quotes, so we can From 5f7862a56738607f5b5404306e480c293990b6c2 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 14:14:37 +0000 Subject: [PATCH 24/27] Fix docs Co-authored-by: Gilles Peskine Signed-off-by: Dave Rodgman --- tests/scripts/quiet/quiet.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/quiet/quiet.sh b/tests/scripts/quiet/quiet.sh index 5b341294f7..01ef422e32 100755 --- a/tests/scripts/quiet/quiet.sh +++ b/tests/scripts/quiet/quiet.sh @@ -18,8 +18,8 @@ # TOOL - the name of the tool that is being wrapped (with no path), e.g. "make" # # NO_SILENCE - a regex that describes the commandline arguments for which output will not -# be silenced, e.g. " --version | test ". In this example, "make test" will -# not be silent, but "make lib test" will be. +# be silenced, e.g. " --version | test ". In this example, "make lib test" will +# not be silent, but "make lib" will be. # Locate original tool TOOL_WITH_PATH=$(dirname "$0")/$TOOL From 869e310456725ae18a32c7468f7777f002e998c4 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 14:59:40 +0000 Subject: [PATCH 25/27] Use export to set VERBOSE_LOGS Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 2 +- tests/scripts/quiet/make | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index 586397887f..854375ecb4 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -8,7 +8,7 @@ # If you are debugging a build / CI issue, you can get complete unsilenced logs # by un-commenting the following line (or setting VERBOSE_LOGS in your environment): -# VERBOSE_LOGS=1 +# export VERBOSE_LOGS=1 # don't silence invocations containing these arguments export NO_SILENCE=" --version " diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index 24e77951c2..b2323166df 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -8,7 +8,7 @@ # If you are debugging a build / CI issue, you can get complete unsilenced logs # by un-commenting the following line (or setting VERBOSE_LOGS in your environment): -# VERBOSE_LOGS=1 +# export VERBOSE_LOGS=1 # don't silence invocations containing these arguments export NO_SILENCE=" --version | test " From 87218b364dfa1ce1c92b1ef1c118a42cce2eace7 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 15:01:29 +0000 Subject: [PATCH 26/27] blank line for readability Signed-off-by: Dave Rodgman --- tests/scripts/quiet/cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake index 854375ecb4..930931d539 100755 --- a/tests/scripts/quiet/cmake +++ b/tests/scripts/quiet/cmake @@ -8,6 +8,7 @@ # If you are debugging a build / CI issue, you can get complete unsilenced logs # by un-commenting the following line (or setting VERBOSE_LOGS in your environment): + # export VERBOSE_LOGS=1 # don't silence invocations containing these arguments From 79aaaa46e9390d7752d2f76e941d69ec85c13441 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 29 Feb 2024 18:41:36 +0000 Subject: [PATCH 27/27] Fix formatting Signed-off-by: Dave Rodgman --- tests/scripts/quiet/make | 1 + tests/scripts/quiet/quiet.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make index b2323166df..d022551df1 100755 --- a/tests/scripts/quiet/make +++ b/tests/scripts/quiet/make @@ -8,6 +8,7 @@ # If you are debugging a build / CI issue, you can get complete unsilenced logs # by un-commenting the following line (or setting VERBOSE_LOGS in your environment): + # export VERBOSE_LOGS=1 # don't silence invocations containing these arguments diff --git a/tests/scripts/quiet/quiet.sh b/tests/scripts/quiet/quiet.sh index 01ef422e32..30ee569a22 100755 --- a/tests/scripts/quiet/quiet.sh +++ b/tests/scripts/quiet/quiet.sh @@ -8,6 +8,7 @@ # If you are debugging a build / CI issue, you can get complete unsilenced logs # by un-commenting the following line (or setting VERBOSE_LOGS in your environment): +# # VERBOSE_LOGS=1 # # This script provides most of the functionality for the adjacent make and cmake