From 33f9f61c5a22d90c6e7a5dfda870ea284ef63581 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 5 Sep 2014 17:22:22 +0200 Subject: use random ports in tests, unless a port is provided --- tests/dsa/testdsa | 5 +++-- tests/openpgp-certs/testcerts | 3 ++- tests/scripts/common.sh | 2 ++ tests/suite/testcompat-main | 3 ++- tests/suite/testpkcs11 | 3 ++- tests/suite/testsrn | 3 ++- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/dsa/testdsa b/tests/dsa/testdsa index 4da172f178..650beb71af 100755 --- a/tests/dsa/testdsa +++ b/tests/dsa/testdsa @@ -23,7 +23,6 @@ srcdir="${srcdir:-.}" SERV="${SERV:-../../src/gnutls-serv} -q" CLI="${CLI:-../../src/gnutls-cli}" -PORT="${PORT:-5558}" DEBUG="" unset RETCODE @@ -33,7 +32,9 @@ fi . $srcdir/../scripts/common.sh -echo "Checking various DSA key sizes" +PORT="${PORT:-$RPORT}" + +echo "Checking various DSA key sizes (port $PORT)" # DSA 1024 + TLS 1.0 diff --git a/tests/openpgp-certs/testcerts b/tests/openpgp-certs/testcerts index 6a90d14dea..add6908216 100755 --- a/tests/openpgp-certs/testcerts +++ b/tests/openpgp-certs/testcerts @@ -23,7 +23,6 @@ srcdir="${srcdir:-.}" SERV="${SERV:-../../src/gnutls-serv} -q" CLI="${CLI:-../../src/gnutls-cli}" -PORT="${PORT:-5557}" DEBUG="" if test "${WINDIR}" != "";then @@ -32,6 +31,8 @@ fi . $srcdir/../scripts/common.sh +PORT="${PORT:-$RPORT}" + echo "Checking OpenPGP certificate verification" launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile $srcdir/srv-public-127.0.0.1-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$! diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh index de4cd85494..401d290621 100644 --- a/tests/scripts/common.sh +++ b/tests/scripts/common.sh @@ -18,6 +18,8 @@ # along with this file; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +RPORT="$((((RANDOM<<15)|RANDOM) % 63001 + 2000))" + fail() { PID=$1 shift; diff --git a/tests/suite/testcompat-main b/tests/suite/testcompat-main index e53cfe331d..7f468211e2 100755 --- a/tests/suite/testcompat-main +++ b/tests/suite/testcompat-main @@ -22,7 +22,6 @@ srcdir="${srcdir:-.}" CLI="${CLI:-../../src/gnutls-cli$EXEEXT}" -PORT="${PORT:-5568}" unset RETCODE if ! test -z "${VALGRIND}";then VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}" @@ -34,6 +33,8 @@ fi . $srcdir/../scripts/common.sh +PORT="${PORT:-$RPORT}" + SERV=openssl OPENSSL_CLI="openssl" diff --git a/tests/suite/testpkcs11 b/tests/suite/testpkcs11 index 2ffea3f794..a924cce350 100755 --- a/tests/suite/testpkcs11 +++ b/tests/suite/testpkcs11 @@ -24,7 +24,6 @@ CERTTOOL="${CERTTOOL:-../../src/certtool$EXEEXT}" DIFF="${DIFF:-diff -b -B}" SERV="${SERV:-../../src/gnutls-serv$EXEEXT} -q" CLI="${CLI:-../../src/gnutls-cli$EXEEXT}" -PORT="${PORT:-5561}" RETCODE=0 TMPFILE=$srcdir/testpkcs11.debug @@ -38,6 +37,8 @@ P11TOOL="$P11TOOL --batch" . $srcdir/../scripts/common.sh +PORT="${PORT:-$RPORT}" + rm -f $TMPFILE exit_error () { diff --git a/tests/suite/testsrn b/tests/suite/testsrn index 1e5ab1d9d3..a9dfeaae95 100755 --- a/tests/suite/testsrn +++ b/tests/suite/testsrn @@ -23,7 +23,6 @@ srcdir="${srcdir:-.}" SERV="${SERV:-../../src/gnutls-serv$EXEEXT} -q" CLI="${CLI:-../../src/gnutls-cli$EXEEXT}" -PORT="${PORT:-5558}" unset RETCODE if test "${WINDIR}" != "";then @@ -32,6 +31,8 @@ fi . $srcdir/../scripts/common.sh +PORT="${PORT:-$RPORT}" + echo "Checking Safe renegotiation" launch_server $$ --echo --priority NORMAL:+ANON-DH:%PARTIAL_RENEGOTIATION --dhparams $srcdir/params.dh >/dev/null 2>&1 & -- cgit v1.2.1