Add seed cmdline arg to test scripts

This commit is contained in:
Andres AG 2016-10-10 15:46:20 +01:00 committed by Simon Butcher
parent e3d882ad4a
commit 7770ea82d5
2 changed files with 24 additions and 1 deletions

View File

@ -32,6 +32,7 @@ CONFIG_BAK="$CONFIG_H.bak"
MEMORY=0
FORCE=0
RELEASE=0
# Default commands, can be overriden by the environment
: ${OPENSSL:="openssl"}
@ -48,6 +49,8 @@ usage()
printf " -h|--help\t\tPrint this help.\n"
printf " -m|--memory\t\tAdditional optional memory tests.\n"
printf " -f|--force\t\tForce the tests to overwrite any modified files.\n"
printf " -s|--seed\t\tInteger seed value to use for this test run.\n"
printf " -r|--release-test\t\tRun this script in release mode. This fixes the seed value to 1.\n"
printf " --out-of-source-dir=<path>\t\tDirectory used for CMake out-of-source build tests."
printf " --openssl=<OpenSSL_path>\t\tPath to OpenSSL executable to use for most tests.\n"
printf " --openssl-legacy=<OpenSSL_path>\t\tPath to OpenSSL executable to use for legacy tests e.g. SSLv3.\n"
@ -106,6 +109,13 @@ while [ $# -gt 0 ]; do
--force|-f)
FORCE=1
;;
--seed|-s)
shift
SEED="$1"
;;
--release-test|-r)
RELEASE=1
;;
--out-of-source-dir)
shift
OUT_OF_SOURCE_DIR="$1"
@ -171,9 +181,15 @@ else
fi
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"
echo "SEED: ${SEED-"UNSET"}"
echo "OPENSSL: $OPENSSL"
echo "OPENSSL_LEGACY: $OPENSSL_LEGACY"
echo "GNUTLS_CLI: $GNUTLS_CLI"
@ -187,6 +203,9 @@ export OPENSSL_CMD="$OPENSSL"
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
# Make sure the tools we need are available.
check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \
"$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \

View File

@ -58,6 +58,7 @@ print_usage() {
printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n"
printf " -s|--show-numbers\tShow test numbers in front of test names\n"
printf " -p|--preserve-logs\tPreserve logs of successful tests as well\n"
printf " --seed\tInteger seed value to use for this test run\n"
}
get_options() {
@ -81,6 +82,9 @@ get_options() {
-p|--preserve-logs)
PRESERVE_LOGS=1
;;
--seed)
shift; SEED="$1"
;;
-h|--help)
print_usage
exit 0
@ -595,7 +599,7 @@ unset PORT_BASE
# +SRV_PORT will be replaced by either $SRV_PORT or $PXY_PORT later
P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT"
P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT"
P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT"
P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT ${SEED:+"seed=$SEED"}"
O_SRV="$O_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem"
O_CLI="$O_CLI -connect localhost:+SRV_PORT"
G_SRV="$G_SRV -p $SRV_PORT"