From 262329603d3527d732dab76a68ed759e9aeeb3a0 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 21 Mar 2018 08:35:07 +0100 Subject: [PATCH 1/3] all.sh: with --no-armcc, don't call armcc from output_env.sh When not running armcc, don't try to invoke armcc at all, not even to report its version. --- scripts/output_env.sh | 14 ++++++++------ tests/scripts/all.sh | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/output_env.sh b/scripts/output_env.sh index 1afaac33e..e9ad8c5d7 100755 --- a/scripts/output_env.sh +++ b/scripts/output_env.sh @@ -47,13 +47,15 @@ print_version() print_version "uname" "-a" "" echo -: ${ARMC5_CC:=armcc} -print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2" -echo +if [ "${RUN_ARMCC:-1}" -ne 0 ]; then + : "${ARMC5_CC:=armcc}" + print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2" + echo -: ${ARMC6_CC:=armclang} -print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2" -echo + : "${ARMC6_CC:=armclang}" + print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2" + echo +fi print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1" echo diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 67b22cdbd..1f8877609 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -447,7 +447,7 @@ msg "info: output_env.sh" OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \ GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \ GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \ - ARMC6_CC="$ARMC6_CC" scripts/output_env.sh + ARMC6_CC="$ARMC6_CC" RUN_ARMCC="$RUN_ARMCC" scripts/output_env.sh msg "test: recursion.pl" # < 1s tests/scripts/recursion.pl library/*.c From 8a244c90a8b2fe9f34a53593115765b306f4691e Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 21 Mar 2018 08:39:32 +0100 Subject: [PATCH 2/3] all.sh: option parsing: reduce vertical spread Only whitespace changes. --- tests/scripts/all.sh | 87 ++++++++++---------------------------------- 1 file changed, 19 insertions(+), 68 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 1f8877609..ffef9ed3c 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -214,74 +214,25 @@ check_tools() while [ $# -gt 0 ]; do case "$1" in - --armcc) - RUN_ARMCC=1 - ;; - --armc5-bin-dir) - shift - ARMC5_BIN_DIR="$1" - ;; - --armc6-bin-dir) - shift - ARMC6_BIN_DIR="$1" - ;; - --force|-f) - FORCE=1 - ;; - --gnutls-cli) - shift - GNUTLS_CLI="$1" - ;; - --gnutls-legacy-cli) - shift - GNUTLS_LEGACY_CLI="$1" - ;; - --gnutls-legacy-serv) - shift - GNUTLS_LEGACY_SERV="$1" - ;; - --gnutls-serv) - shift - GNUTLS_SERV="$1" - ;; - --help|-h) - usage - exit - ;; - --keep-going|-k) - KEEP_GOING=1 - ;; - --memory|-m) - MEMORY=1 - ;; - --no-armcc) - RUN_ARMCC=0 - ;; - --no-yotta) - YOTTA=0 - ;; - --openssl) - shift - OPENSSL="$1" - ;; - --openssl-legacy) - shift - OPENSSL_LEGACY="$1" - ;; - --out-of-source-dir) - shift - OUT_OF_SOURCE_DIR="$1" - ;; - --release-test|-r) - RELEASE=1 - ;; - --seed|-s) - shift - SEED="$1" - ;; - --yotta) - YOTTA=1 - ;; + --armcc) RUN_ARMCC=1;; + --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";; + --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";; + --force|-f) FORCE=1;; + --gnutls-cli) shift; GNUTLS_CLI="$1";; + --gnutls-legacy-cli) shift; GNUTLS_LEGACY_CLI="$1";; + --gnutls-legacy-serv) shift; GNUTLS_LEGACY_SERV="$1";; + --gnutls-serv) shift; GNUTLS_SERV="$1";; + --help|-h) usage; exit;; + --keep-going|-k) KEEP_GOING=1;; + --memory|-m) MEMORY=1;; + --no-armcc) RUN_ARMCC=0;; + --no-yotta) YOTTA=0;; + --openssl) shift; OPENSSL="$1";; + --openssl-legacy) shift; OPENSSL_LEGACY="$1";; + --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";; + --release-test|-r) RELEASE=1;; + --seed|-s) shift; SEED="$1";; + --yotta) YOTTA=1;; *) echo >&2 "Unknown option: $1" echo >&2 "Run $0 --help for usage." From 38d816586523b2258cb4d4c783a29d339efdf437 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 21 Mar 2018 08:40:26 +0100 Subject: [PATCH 3/3] all.sh: add opposites to all boolean options All options can now be overridden by a subsequent option, e.g. "all.sh --foo --no-foo" is equivalent to "all.sh --no-foo". This allows making wrapper scripts with default options and occasionally overriding those options when running the wrapper script. --- tests/scripts/all.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index ffef9ed3c..557c7bfcf 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -94,7 +94,6 @@ CONFIG_BAK="$CONFIG_H.bak" MEMORY=0 FORCE=0 KEEP_GOING=0 -RELEASE=0 RUN_ARMCC=1 YOTTA=1 @@ -126,8 +125,12 @@ General options: -m|--memory Additional optional memory tests. --armcc Run ARM Compiler builds (on by default). --no-armcc Skip ARM Compiler builds. + --no-force Refuse to overwrite modified files (default). + --no-keep-going Stop at the first error (default). + --no-memory No additional memory tests (default). --no-yotta Skip yotta module build. --out-of-source-dir= Directory used for CMake out-of-source build tests. + --random-seed Use a random seed value for randomized tests (default). -r|--release-test Run this script in release mode. This fixes the seed value to 1. -s|--seed Integer seed value to use for this test run. --yotta Build yotta module (on by default). @@ -226,11 +229,15 @@ while [ $# -gt 0 ]; do --keep-going|-k) KEEP_GOING=1;; --memory|-m) MEMORY=1;; --no-armcc) RUN_ARMCC=0;; + --no-force) FORCE=0;; + --no-keep-going) KEEP_GOING=0;; + --no-memory) MEMORY=0;; --no-yotta) YOTTA=0;; --openssl) shift; OPENSSL="$1";; --openssl-legacy) shift; OPENSSL_LEGACY="$1";; --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";; - --release-test|-r) RELEASE=1;; + --random-seed) unset SEED;; + --release-test|-r) SEED=1;; --seed|-s) shift; SEED="$1";; --yotta) YOTTA=1;; *) @@ -337,11 +344,6 @@ if_build_succeeded () { fi } -if [ $RELEASE -eq 1 ]; then - # Fix the seed value to 1 to ensure that the tests are deterministic. - SEED=1 -fi - msg "info: $0 configuration" echo "MEMORY: $MEMORY" echo "FORCE: $FORCE" @@ -367,7 +369,9 @@ export GNUTLS_CLI="$GNUTLS_CLI" export GNUTLS_SERV="$GNUTLS_SERV" # Avoid passing --seed flag in every call to ssl-opt.sh -[ ! -z ${SEED+set} ] && export SEED +if [ -n "${SEED-}" ]; then + export SEED +fi # Make sure the tools we need are available. check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \