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  a4638103d3091c4c95e2d13bcc2b7c2fa08cf994 (commit)
      from  6526bd881f3d820f4c7ab5e3ba4d9b1964e6c0b6 (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=a4638103d3091c4c95e2d13bcc2b7c2fa08cf994


commit a4638103d3091c4c95e2d13bcc2b7c2fa08cf994
Author: Mats Erik Andersson <[email protected]>
Date:   Sat Nov 26 19:25:47 2011 +0100

    tests/tftp.sh: Improve robustness and portability.

diff --git a/ChangeLog b/ChangeLog
index 168a8c8..11926d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-26  Mats Erik Andersson <[email protected]>
 
+       * tests/tftp.sh (INETD_PID): New variable; allows better robustness.
+       Improve patterns to fit also BSD.
+
+2011-11-26  Mats Erik Andersson <[email protected]>
+
        * configure.ac: Check presence of <protocols/talkd.h>. Disable
        building of `talk' and `talkd' if it is missing.
        * ftpd/Makefile.am (ftpd_SOURCES): Exclude unused `logwtmp.c'.
diff --git a/tests/tftp.sh b/tests/tftp.sh
index b670c63..023b0d7 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -32,6 +32,7 @@ AF=${AF:-inet}
 PROTO=${PROTO:-udp}
 PORT=${PORT:-7777}
 INETD_CONF="$PWD/inetd.conf.tmp"
+INETD_PID="$PWD/inetd.pid.$$"
 
 ADDRESSES="`$IFCONFIG | sed -e "/$AF /!d" \
      -e "s/^.*$AF[[:blank:]]\([:.0-9]\{1,\}\)[[:blank:]].*$/\1/g"`"
@@ -50,7 +51,7 @@ if [ "$VERBOSE" ]; then
 fi
 
 # Check that the port is still available
-netstat -na | grep -q "^$PROTO .*$PORT "
+netstat -na | grep -q -E "^$PROTO(4|6|46)? .*$PORT "
 if test $? -eq 0; then
     echo "Desired port $PORT/$PROTO is already in use."
     exit 1
@@ -64,8 +65,9 @@ $PORT dgram $PROTO wait $USER $TFTPD   tftpd -l 
`pwd`/tftp-test
 EOF
 
 # Launch `inetd', assuming it's reachable at all $ADDRESSES.
-$INETD -d "$INETD_CONF" &
-inetd_pid="$!"
+$INETD -d -p"$INETD_PID" "$INETD_CONF" &
+sleep 1
+inetd_pid="$(cat $INETD_PID)"
 
 test -z "$VERBOSE" || echo "Launched Inetd as process $inetd_pid." >&2
 
@@ -73,7 +75,7 @@ test -z "$VERBOSE" || echo "Launched Inetd as process 
$inetd_pid." >&2
 sleep 1
 
 # Did `inetd' really succeed in establishing a listener?
-netstat -na | grep "^$PROTO .*$PORT "
+netstat -na | grep -q -E "^$PROTO(4|6|46)? .*$PORT "
 if test $? -ne 0; then
     # No it did not.
     ps "$inetd_pid" >/dev/null 2>&1 && kill "$inetd_pid"
@@ -113,7 +115,7 @@ done
 
 ps "$inetd_pid" >/dev/null 2>&1 && kill "$inetd_pid"
 
-rm -rf tftp-test tftp-test-file "$INETD_CONF"
+rm -rf tftp-test tftp-test-file "$INETD_CONF" "$INETD_PID"
 
 # Minimal clean up
 echo

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

Summary of changes:
 ChangeLog     |    5 +++++
 tests/tftp.sh |   12 +++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 

_______________________________________________
Commit-inetutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/commit-inetutils

Reply via email to