commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-13-g408acf


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-13-g408acfb
Date: Fri, 27 Jan 2012 13:57:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  408acfb3c91204651d2c69be0443bbf4c6ce8be8 (commit)
      from  9b93c80dea90d3e361d4004a773965f7ff553e8f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=408acfb3c91204651d2c69be0443bbf4c6ce8be8


commit 408acfb3c91204651d2c69be0443bbf4c6ce8be8
Author: Mats Erik Andersson <address@hidden>
Date:   Fri Jan 27 14:41:59 2012 +0100

    Seek free port while testing.

diff --git a/ChangeLog b/ChangeLog
index 8ca972f..13f58a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-27  Mats Erik Andersson <address@hidden>
+
+       * tests/ftp-localhost.sh, tests/tftp.sh (PORT): Detect if it
+       is preset, or detect an unused value from a short list.
+
 2012-01-26  Mats Erik Andersson <address@hidden>
 
        * tests/syslogd.sh (SOCKET): Disable the use of this
diff --git a/tests/ftp-localhost.sh b/tests/ftp-localhost.sh
index 431ecaa..1c7ef07 100755
--- a/tests/ftp-localhost.sh
+++ b/tests/ftp-localhost.sh
@@ -94,8 +94,40 @@ posttesting () {
 
 trap posttesting 0 1 2 3 15
 
-echo "4711 stream tcp4 nowait root $PWD/$FTPD ftpd -A -l" > $TMPDIR/inetd.conf
-echo "4711 stream tcp6 nowait root $PWD/$FTPD ftpd -A -l" >> $TMPDIR/inetd.conf
+# locate_port  port
+#
+# Test for IPv4 as well as for IPv6.
+locate_port () {
+    if [ "`uname -s`" = "SunOS" ]; then
+       netstat -na -finet -finet6 -Ptcp |
+       grep "\.$1[^0-9]" >/dev/null 2>&1
+    else
+       netstat -na |
+       grep "^$2\(4\|6\|46\)\{0,1\}.*[^0-9]$1[^0-9]" >/dev/null 2>&1
+    fi
+}
+
+# Find an available port number.  There will be some
+# room left for a race condition, but we try to be
+# flexible enough for running copies of this script.
+#
+if test -z "$PORT"; then
+    for PORT in 4711 4713 4717 4725 4741 4773 none; do
+       test $PORT = none && break
+       if locate_port $PORT; then
+           continue
+       else
+           break
+       fi
+    done
+    if test "$PORT" = 'none'; then
+       echo 'Our port allocation failed.  Skipping test.'
+       exit 77
+    fi
+fi
+
+echo "$PORT stream tcp4 nowait root $PWD/$FTPD ftpd -A -l" > $TMPDIR/inetd.conf
+echo "$PORT stream tcp6 nowait root $PWD/$FTPD ftpd -A -l" >> 
$TMPDIR/inetd.conf
 echo "machine $TARGET login ftp password foobar" > $TMPDIR/.netrc
 echo "machine $TARGET6 login ftp password foobar" >> $TMPDIR/.netrc
 echo "machine $TARGET46 login ftp password foobar" >> $TMPDIR/.netrc
@@ -113,7 +145,7 @@ cat <<STOP |
 rstatus
 dir
 STOP
-HOME=$TMPDIR $FTP $TARGET 4711 -4 -v -p -t >$TMPDIR/ftp.stdout
+HOME=$TMPDIR $FTP $TARGET $PORT -4 -v -p -t >$TMPDIR/ftp.stdout
 
 errno=$?
 [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -147,7 +179,7 @@ cat <<STOP |
 rstatus
 dir
 STOP
-HOME=$TMPDIR $FTP $TARGET 4711 -4 -v -t >$TMPDIR/ftp.stdout
+HOME=$TMPDIR $FTP $TARGET $PORT -4 -v -t >$TMPDIR/ftp.stdout
 
 errno=$?
 [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -182,7 +214,7 @@ rstatus
 epsv4
 dir
 STOP
-HOME=$TMPDIR $FTP $TARGET 4711 -4 -v -p -t >$TMPDIR/ftp.stdout
+HOME=$TMPDIR $FTP $TARGET $PORT -4 -v -p -t >$TMPDIR/ftp.stdout
 
 errno=$?
 [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -217,7 +249,7 @@ rstatus
 epsv4
 dir
 STOP
-HOME=$TMPDIR $FTP $TARGET 4711 -4 -v -t >$TMPDIR/ftp.stdout
+HOME=$TMPDIR $FTP $TARGET $PORT -4 -v -t >$TMPDIR/ftp.stdout
 
 errno=$?
 [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -251,7 +283,7 @@ cat <<STOP |
 rstatus
 dir
 STOP
-HOME=$TMPDIR $FTP $TARGET6 4711 -6 -v -p -t >$TMPDIR/ftp.stdout
+HOME=$TMPDIR $FTP $TARGET6 $PORT -6 -v -p -t >$TMPDIR/ftp.stdout
 
 errno=$?
 [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -285,7 +317,7 @@ cat <<STOP |
 rstatus
 dir
 STOP
-HOME=$TMPDIR $FTP $TARGET6 4711 -6 -v -t >$TMPDIR/ftp.stdout
+HOME=$TMPDIR $FTP $TARGET6 $PORT -6 -v -t >$TMPDIR/ftp.stdout
 
 errno=$?
 [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -369,7 +401,7 @@ if $have_address_mapping && test -n "$TARGET46" ; then
        rstatus
        dir
        STOP
-    HOME=$TMPDIR $FTP $TARGET46 4711 -6 -v -p -t >$TMPDIR/ftp.stdout
+    HOME=$TMPDIR $FTP $TARGET46 $PORT -6 -v -p -t >$TMPDIR/ftp.stdout
 
     errno=$?
     [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
@@ -403,7 +435,7 @@ if $have_address_mapping && test -n "$TARGET46" ; then
        rstatus
        dir
        STOP
-    HOME=$TMPDIR $FTP $TARGET46 4711 -6 -v -t >$TMPDIR/ftp.stdout
+    HOME=$TMPDIR $FTP $TARGET46 $PORT -6 -v -t >$TMPDIR/ftp.stdout
 
     errno=$?
     [ -z "$VERBOSE" ] || cat $TMPDIR/ftp.stdout
diff --git a/tests/tftp.sh b/tests/tftp.sh
index e43dacc..24c43bf 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -47,7 +47,6 @@ fi
 
 AF=${AF:-inet}
 PROTO=${PROTO:-udp}
-PORT=${PORT:-7777}
 USER=`id -u -n`
 
 # Random base diractory at testing time.
@@ -92,7 +91,8 @@ fi
 #
 locate_port () {
     if [ "`uname -s`" = "SunOS" ]; then
-       netstat -na -f$1 -P$2 | grep "\.$3[^0-9]" >/dev/null 2>&1
+       netstat -na -f$1 -P$2 |
+       grep "\.$3[^0-9]" >/dev/null 2>&1
     else
        netstat -na |
        grep "^$2\(4\|6\|46\)\{0,1\}.*[^0-9]$3[^0-9]" >/dev/null 2>&1
@@ -105,11 +105,23 @@ if [ "$VERBOSE" ]; then
     "$INETD" --version
 fi
 
-# Check that the port is still available
-locate_port $AF $PROTO $PORT
-if test $? -eq 0; then
-    echo "Desired port $PORT/$PROTO is already in use."
-    exit 77
+# Find an available port number.  There will be some
+# room left for a race condition, but we try to be
+# flexible enough for running copies of this script.
+#
+if test -z "$PORT"; then
+    for PORT in 7777 7779 7783 7791 7807 7839 none; do
+       test $PORT = none && break
+       if locate_port $AF $PROTO $PORT; then
+           continue
+       else
+           break
+       fi
+    done
+    if test "$PORT" = 'none'; then
+       echo 'Our port allocation failed.  Skipping test.'
+       exit 77
+    fi
 fi
 
 # Create `inetd.conf'.  Note: We want $TFTPD to be an absolute file

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog              |    5 ++++
 tests/ftp-localhost.sh |   52 ++++++++++++++++++++++++++++++++++++++---------
 tests/tftp.sh          |   26 +++++++++++++++++------
 3 files changed, 66 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]