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-9-ga98c806


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-9-ga98c806
Date: Mon, 23 Jan 2012 11:47:59 +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  a98c806d93ae9f640b3f3dba038bcf3dbc71da3c (commit)
      from  273d270ca3543c2b2fced41113359e290630190f (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=a98c806d93ae9f640b3f3dba038bcf3dbc71da3c


commit a98c806d93ae9f640b3f3dba038bcf3dbc71da3c
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Jan 23 12:48:20 2012 +0100

    Portability of FTP and TFTP tests.

diff --git a/ChangeLog b/ChangeLog
index 5f1d26b..8b1da24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-01-23  Mats Erik Andersson <address@hidden>
+
+       * tests/ftp-localhost.sh: New preamble to fail
+       with SVR4 shell.  Backtics in command substitution.
+       * tests/tftp.sh: Rewrite for SVR4 portability.
+       Backtics in command substitution.  expr(1) for
+       arithmetic.  Only basic regex with grep(1), no `-q'.
+       Remove character classes.  Quotation issue for tr(1).
+       Use `test -r /dev/urandom' to circumvent soft link.
+
 2012-01-22  Mats Erik Andersson <address@hidden>
 
        * tests/tftp.sh (USER): Calculate as `id -u -n'.
diff --git a/tests/ftp-localhost.sh b/tests/ftp-localhost.sh
index 171e9c3..01135e7 100755
--- a/tests/ftp-localhost.sh
+++ b/tests/ftp-localhost.sh
@@ -43,6 +43,18 @@ if [ $VERBOSE ]; then
     $INETD --version | head -1
 fi
 
+# This script is using '! command' in many tests,
+# which is not available in old shells.  We fail
+# for those old shell releases.
+if eval '! false' 2>/dev/null; then
+    :  # This is expected
+else
+    echo 'Presently using the SVR4 Bourne shell.'
+    echo 'This test needs a recent shell with'
+    echo 'keyword ! and tilde expansion.'
+    exit 77
+fi
+
 if [ `id -u` != 0 ]; then
     echo "ftpd needs to run as root"
     exit 77
@@ -65,7 +77,7 @@ TMPDIR=`mktemp -d $PWD/tmp.XXXXXXXXXX`
 
 posttesting () {
     test -f "$TMPDIR/inetd.pid" && test -r "$TMPDIR/inetd.pid" \
-       && kill -9 "$(cat $TMPDIR/inetd.pid)"
+       && kill -9 "`cat $TMPDIR/inetd.pid`"
     rm -rf "$TMPDIR"
 }
 
diff --git a/tests/tftp.sh b/tests/tftp.sh
index 3a1217d..06b72b7 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -42,9 +42,9 @@ INETD_PID="$TMPDIR/inetd.pid.$$"
 
 posttesting () {
     if test -f "$INETD_PID" && test -r "$INETD_PID" \
-       && ps "$(cat $INETD_PID)" >/dev/null 2>&1
+       && ps "`cat $INETD_PID`" >/dev/null 2>&1
     then
-       kill -9 "$(cat $INETD_PID)"
+       kill -9 "`cat $INETD_PID`" 2>/dev/null
     fi
     rm -rf "$TMPDIR" $FILELIST
 }
@@ -61,7 +61,7 @@ ADDRESSES="${ADDRESSES:-127.0.0.1}"
 
 if [ "$ADDRESSES" = "sense" ]; then
     ADDRESSES="`$IFCONFIG | sed -e "/$AF /!d" \
-       -e "s/^.*$AF[[:blank:]]\([:.0-9]\{1,\}\)[[:blank:]].*$/\1/g"`"
+       -e "s/^.*$AF \([:.0-9]\{1,\}\) .*$/\1/g"`"
 fi
 
 # Check that netstat works before proceeding.
@@ -76,10 +76,11 @@ fi
 # locate_port family proto port
 #
 locate_port () {
-    if [ "$(uname -s)" = "SunOS" ]; then
-       netstat -na -f$1 -P$2 | grep -q -E "\.$3[^0-9]"
+    if [ "`uname -s`" = "SunOS" ]; then
+       netstat -na -f$1 -P$2 | grep "\.$3[^0-9]" >/dev/null 2>&1
     else
-       netstat -na | grep -q -E "^$2(4|6|46)?.*[^0-9]$3[^0-9]"
+       netstat -na |
+       grep "^$2\(4\|6\|46\)\{0,1\}.*[^0-9]$3[^0-9]" >/dev/null 2>&1
     fi
 }
 
@@ -90,7 +91,7 @@ if [ "$VERBOSE" ]; then
 fi
 
 # Check that the port is still available
-locate_port inet $PROTO $PORT
+locate_port $AF $PROTO $PORT
 if test $? -eq 0; then
     echo "Desired port $PORT/$PROTO is already in use."
     exit 77
@@ -106,7 +107,7 @@ EOF
 # Launch `inetd', assuming it's reachable at all $ADDRESSES.
 $INETD -d -p"$INETD_PID" "$INETD_CONF" &
 sleep 1
-inetd_pid="$(cat $INETD_PID)"
+inetd_pid="`cat $INETD_PID`"
 
 test -z "$VERBOSE" || echo "Launched Inetd as process $inetd_pid." >&2
 
@@ -114,15 +115,15 @@ test -z "$VERBOSE" || echo "Launched Inetd as process 
$inetd_pid." >&2
 sleep 1
 
 # Did `inetd' really succeed in establishing a listener?
-locate_port inet $PROTO $PORT
+locate_port $AF $PROTO $PORT
 if test $? -ne 0; then
     # No it did not.
-    ps "$inetd_pid" >/dev/null 2>&1 && kill "$inetd_pid"
+    ps "$inetd_pid" >/dev/null 2>&1 && kill "$inetd_pid" 2>/dev/null
     echo "Failed in starting correct Inetd instance." >&2
     exit 1
 fi
 
-if [ -f /dev/urandom ]; then
+if [ -r /dev/urandom ]; then
     input="/dev/urandom"
 else
     input="/dev/zero"
@@ -149,23 +150,23 @@ while read name bsize count; do
        bs=$bsize count=$count 2>/dev/null
 done
 
-FILELIST="$(echo "$FILEDATA" | sed 's/[[:space:]].*//' | tr "\n" ' ')"
+FILELIST="`echo "$FILEDATA" | sed 's/ .*//' | tr "\n" ' '`"
 
 SUCCESSES=0
 EFFORTS=0
 RESULT=0
 
-echo "Looking into \"$(echo $ADDRESSES | tr "\n" " ")\"."
+echo "Looking into '`echo $ADDRESSES | tr "\n" ' '`'."
 
 for addr in $ADDRESSES; do
     echo "trying with address \`$addr'..." >&2
 
     for name in $FILELIST; do
-       EFFORTS=$((EFFORTS + 1))
+       EFFORTS=`expr $EFFORTS + 1`
        rm -f $name
        echo "get $name" | "$TFTP" $addr $PORT
 
-       cmp "$TMPDIR/tftp-test/$name" "$name"
+       cmp "$TMPDIR/tftp-test/$name" "$name" 2>/dev/null
        result=$?
 
        if [ "$result" -ne 0 ]; then
@@ -173,7 +174,7 @@ for addr in $ADDRESSES; do
            test -z "$VERBOSE" || echo "Failed comparison for $addr/$name." >&2
            RESULT=$result
        else
-           SUCCESSES=$((SUCCESSES + 1))
+           SUCCESSES=`expr $SUCCESSES + 1`
            test -z "$VERBOSE" || echo "Successful comparison for $addr/$name." 
>&2
        fi
    done

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

Summary of changes:
 ChangeLog              |   10 ++++++++++
 tests/ftp-localhost.sh |   14 +++++++++++++-
 tests/tftp.sh          |   33 +++++++++++++++++----------------
 3 files changed, 40 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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