ssl-opt.sh: support fixed seed for random tests

Support --seed and $SEED to set the seed for random tests.

Partial backport of commit 7770ea82d5
(the part applying to all.sh is already present).
This commit is contained in:
Gilles Peskine 2017-11-30 15:56:20 +01:00
parent 49349bacb9
commit bb4aaf1bbc

View file

@ -41,6 +41,7 @@ print_usage() {
printf " -m|--memcheck\tCheck memory leaks and errors.\n"
printf " -f|--filter\tOnly matching tests are executed (default: '$FILTER')\n"
printf " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')\n"
printf " --seed\tInteger seed value to use for this test run (default: random)\n"
}
get_options() {
@ -55,6 +56,9 @@ get_options() {
-m|--memcheck)
MEMCHECK=1
;;
--seed)
shift; SEED="$1"
;;
-h|--help)
print_usage
exit 0
@ -564,7 +568,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"