Skip to content

Commit

Permalink
Merge pull request #3442 from mpg/make-coverage-script-deterministic-…
Browse files Browse the repository at this point in the history
…2.16

[Backport 2.16] Make basic-build-test.sh more deterministic
  • Loading branch information
gilles-peskine-arm authored Jun 22, 2020
2 parents 66e4dff + 1bff684 commit b0c2608
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/scripts/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ pre_initialize_variables () {
FORCE=0
KEEP_GOING=0

# Seed value used with the --release-test option.
#
# See also RELEASE_SEED in basic-build-test.sh. Debugging is easier if
# both values are kept in sync. If you change the value here because it
# breaks some tests, you'll definitely want to change it in
# basic-build-test.sh as well.
RELEASE_SEED=1

# Default commands, can be overridden by the environment
: ${OPENSSL:="openssl"}
: ${OPENSSL_LEGACY:="$OPENSSL"}
Expand Down Expand Up @@ -245,7 +253,7 @@ General options:
--no-memory No additional memory tests (default).
--out-of-source-dir=<path> 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.
-r|--release-test Run this script in release mode. This fixes the seed value to ${RELEASE_SEED}.
-s|--seed Integer seed value to use for this test run.
Tool path options:
Expand Down Expand Up @@ -384,7 +392,7 @@ pre_parse_command_line () {
--openssl-next) shift; OPENSSL_NEXT="$1";;
--out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";;
--random-seed) unset SEED;;
--release-test|-r) SEED=1;;
--release-test|-r) SEED=$RELEASE_SEED;;
--seed|-s) shift; SEED="$1";;
-*)
echo >&2 "Unknown option: $1"
Expand Down
8 changes: 8 additions & 0 deletions tests/scripts/basic-build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ fi
: ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"}
: ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"}

# Used to make ssl-opt.sh deterministic.
#
# See also RELEASE_SEED in all.sh. Debugging is easier if both values are kept
# in sync. If you change the value here because it breaks some tests, you'll
# definitely want to change it in all.sh as well.
: ${SEED:=1}
export SEED

# To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh
# we just export the variables they require
export OPENSSL_CMD="$OPENSSL"
Expand Down

0 comments on commit b0c2608

Please sign in to comment.