diff --git a/scripts/output_env.sh b/scripts/output_env.sh deleted file mode 100755 index 32f1f86efc..0000000000 --- a/scripts/output_env.sh +++ /dev/null @@ -1,183 +0,0 @@ -#! /usr/bin/env sh - -# output_env.sh -# -# Copyright The Mbed TLS Contributors -# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later -# -# Purpose -# -# To print out all the relevant information about the development environment. -# -# This includes: -# - architecture of the system -# - type and version of the operating system -# - version of make and cmake -# - version of armcc, clang, gcc-arm and gcc compilers -# - version of libc, clang, asan and valgrind if installed -# - version of gnuTLS and OpenSSL - -print_version() -{ - BIN="$1" - shift - ARGS="$1" - shift - VARIANT="$1" - shift - - if [ -n "$VARIANT" ]; then - VARIANT=" ($VARIANT)" - fi - - if ! type "$BIN" > /dev/null 2>&1; then - echo " * ${BIN##*/}$VARIANT: Not found." - return 0 - fi - - BIN=`which "$BIN"` - VERSION_STR=`$BIN $ARGS 2>&1` - - # Apply all filters - while [ $# -gt 0 ]; do - FILTER="$1" - shift - VERSION_STR=`echo "$VERSION_STR" | $FILTER` - done - - if [ -z "$VERSION_STR" ]; then - VERSION_STR="Version could not be determined." - fi - - echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} " -} - -echo "** Platform:" -echo - -if [ `uname -s` = "Linux" ]; then - echo "Linux variant" - lsb_release -d -c -else - echo "Unknown Unix variant" -fi - -echo - -print_version "uname" "-a" "" - -echo -echo -echo "** Tool Versions:" -echo - -print_version "make" "--version" "" "head -n 1" -echo - -print_version "cmake" "--version" "" "head -n 1" -echo - -if [ "${RUN_ARMCC:-1}" -ne 0 ]; then - : "${ARMC6_CC:=armclang}" - print_version "$ARMC6_CC" "--vsn" "" "head -n 2" - echo -fi - -print_version "arm-none-eabi-gcc" "--version" "" "head -n 1" -echo - -print_version "gcc" "--version" "" "head -n 1" -echo - -if [ -n "${GCC_EARLIEST+set}" ]; then - print_version "${GCC_EARLIEST}" "--version" "" "head -n 1" -else - echo " GCC_EARLIEST : Not configured." -fi -echo - -if [ -n "${GCC_LATEST+set}" ]; then - print_version "${GCC_LATEST}" "--version" "" "head -n 1" -else - echo " GCC_LATEST : Not configured." -fi -echo - -print_version "clang" "--version" "" "head -n 2" -echo - -if [ -n "${CLANG_EARLIEST+set}" ]; then - print_version "${CLANG_EARLIEST}" "--version" "" "head -n 2" -else - echo " CLANG_EARLIEST : Not configured." -fi -echo - -if [ -n "${CLANG_LATEST+set}" ]; then - print_version "${CLANG_LATEST}" "--version" "" "head -n 2" -else - echo " CLANG_LATEST : Not configured." -fi -echo - -print_version "ldd" "--version" "" "head -n 1" -echo - -print_version "valgrind" "--version" "" -echo - -print_version "gdb" "--version" "" "head -n 1" -echo - -print_version "perl" "--version" "" "head -n 2" "grep ." -echo - -print_version "python" "--version" "" "head -n 1" -echo - -print_version "python3" "--version" "" "head -n 1" -echo - -# Find the installed version of Pylint. Installed as a distro package this can -# be pylint3 and as a PEP egg, pylint. In test scripts We prefer pylint over -# pylint3 -if type pylint >/dev/null 2>/dev/null; then - print_version "pylint" "--version" "" "sed /^.*config/d" "grep pylint" -elif type pylint3 >/dev/null 2>/dev/null; then - print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint" -else - echo " * pylint or pylint3: Not found." -fi -echo - -: ${OPENSSL:=openssl} -print_version "$OPENSSL" "version" "default" -echo - -if [ -n "${OPENSSL_NEXT+set}" ]; then - print_version "$OPENSSL_NEXT" "version" "next" -else - echo " * openssl (next): Not configured." -fi -echo - -: ${GNUTLS_CLI:=gnutls-cli} -print_version "$GNUTLS_CLI" "--version" "default" "head -n 1" -echo - -: ${GNUTLS_SERV:=gnutls-serv} -print_version "$GNUTLS_SERV" "--version" "default" "head -n 1" -echo - -echo " * Installed asan versions:" -if type dpkg-query >/dev/null 2>/dev/null; then - if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' | - awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' | - grep . - then - echo " No asan versions installed." - fi -else - echo " Unable to determine the asan version without dpkg." -fi -echo diff --git a/tests/scripts/quiet/cmake b/tests/scripts/quiet/cmake deleted file mode 100755 index a34365bea6..0000000000 --- a/tests/scripts/quiet/cmake +++ /dev/null @@ -1,19 +0,0 @@ -#! /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): - -# export VERBOSE_LOGS=1 - -# don't silence invocations containing these arguments -NO_SILENCE=" --version " - -TOOL="cmake" - -. "$(dirname "$0")/quiet.sh" diff --git a/tests/scripts/quiet/make b/tests/scripts/quiet/make deleted file mode 100755 index 920e5b875f..0000000000 --- a/tests/scripts/quiet/make +++ /dev/null @@ -1,19 +0,0 @@ -#! /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): - -# export VERBOSE_LOGS=1 - -# don't silence invocations containing these arguments -NO_SILENCE=" --version | test " - -TOOL="make" - -. "$(dirname "$0")/quiet.sh" diff --git a/tests/scripts/quiet/quiet.sh b/tests/scripts/quiet/quiet.sh deleted file mode 100644 index 0f26184d0d..0000000000 --- a/tests/scripts/quiet/quiet.sh +++ /dev/null @@ -1,79 +0,0 @@ -# -*-mode: sh; sh-shell: 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 -# -# 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 lib test" will -# not be silent, but "make lib" will be. - -# Identify path to original tool. There is an edge-case here where the quiet wrapper is on the path via -# a symlink or relative path, but "type -ap" yields the wrapper with it's normalised path. We use -# the -ef operator to compare paths, to avoid picking the wrapper in this case (to avoid infinitely -# recursing). -while IFS= read -r ORIGINAL_TOOL; do - if ! [[ $ORIGINAL_TOOL -ef "$0" ]]; then break; fi -done < <(type -ap -- "$TOOL") - -print_quoted_args() { - # similar to printf '%q' "$@" - # but produce more human-readable results for common/simple cases like "a b" - for a in "$@"; do - # Get bash to quote the string - 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 - # 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 -} - -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}" 1>&2 - print_quoted_args "$@" 1>&2 - echo 1>&2 -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