]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: check whether the randomly generate port is used
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 30 Apr 2016 05:14:13 +0000 (07:14 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 30 Apr 2016 05:14:13 +0000 (07:14 +0200)
tests/scripts/common.sh

index fd6588d52f1563f4ccbdc8449628335aecbdaa90..b338201cb23fed49d679219b3c6991be5fc2ce04 100644 (file)
 # along with this file; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-RPORT="$(((($$<<15)|RANDOM) % 63001 + 2000))"
+rc=0
+while test $rc = 0
+do
+       RPORT="$(((($$<<15)|RANDOM) % 63001 + 2000))"
+       netstat -anlt|grep "\:$RPORT"
+       rc=$?
+done
 
 fail() {
    PID="$1"