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-320-gae099


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-320-gae099cd
Date: Wed, 14 Aug 2013 20:50:25 +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  ae099cde5bb2de9ebf4cdf012c5a05aa5a92bc84 (commit)
      from  c488b569fe7f7e6309073acbb7e3950be9fc8a95 (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=ae099cde5bb2de9ebf4cdf012c5a05aa5a92bc84


commit ae099cde5bb2de9ebf4cdf012c5a05aa5a92bc84
Author: Mats Erik Andersson <address@hidden>
Date:   Wed Aug 14 14:55:49 2013 +0200

    One new test script.

diff --git a/ChangeLog b/ChangeLog
index 213dcfe..0d3c0b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-08-14  Mats Erik Andersson  <address@hidden>
+
+       * tests/inetd.sh: New file.
+       * tests/Makefile.am (dist_check_SCRIPTS)
+       [ENABLE_inetd && ENABLE_telnet]: Add inetd.sh.
+
+       * tests/telnet-localhost.sh: Set service node
+       to $TARGET and $TARGET6 in inetd configuration.
+
+       * tests/utmp.sh: Call $SED, not `sed'.
+
 2013-08-09  Mats Erik Andersson  <address@hidden>
 
        * src/syslogd.c (argp_options): Improve `mark' text.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 288acb8..4f53921 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -56,7 +56,7 @@ endif
 
 if ENABLE_inetd
 if ENABLE_telnet
-dist_check_SCRIPTS += telnet-localhost.sh
+dist_check_SCRIPTS += inetd.sh telnet-localhost.sh
 endif
 endif
 
diff --git a/tests/inetd.sh b/tests/inetd.sh
new file mode 100755
index 0000000..c990b9c
--- /dev/null
+++ b/tests/inetd.sh
@@ -0,0 +1,163 @@
+#!/bin/sh
+
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Inetutils.
+#
+# GNU Inetutils is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Inetutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see `http://www.gnu.org/licenses/'.
+
+# Test to establish functionality of inetd.
+# An important part is to run in daemon mode
+# and to send SIGHUP repeatedly.
+#
+# Written by Mats Erik Andersson.
+
+. ./tools.sh
+
+if test -z "${VERBOSE+set}"; then
+    silence=:
+fi
+
+# Portability fix for SVR4
+PWD="${PWD:-`pwd`}"
+USER=${USER:-`func_id_user`}
+
+# Prerequisites
+#
+$need_mktemp || exit_no_mktemp
+
+# Execution control.  Initialise early!
+#
+do_cleandir=false
+
+# Executable under test and helper functionality.
+#
+INETD=${INETD:-../src/inetd$EXEEXT}
+TELNET=${TELNET:-../telnet/telnet$EXEEXT}
+ADDRPEEK=${ADDRPEEK:-$PWD/addrpeek$EXEEXT}
+
+if test ! -x $ADDRPEEK; then
+    echo >&2 "No executable '$ADDRPEEK' present.  Skipping test."
+    exit 77
+fi
+
+if [ ! -x $INETD ]; then
+    echo "Missing executable '$INETD'.  Skipping test." >&2
+    exit 77
+fi
+
+if [ ! -x $TELNET ]; then
+    echo "Missing executable '$TELNET'.  Skipping test." >&2
+    exit 77
+fi
+
+if test -n "$VERBOSE"; then
+    set -x
+    $INETD --version | $SED '1q'
+fi
+
+# For file creation below IU_TESTDIR.
+umask 0077
+
+# Keep any external assignment of testing directory.
+# Otherwise a randomisation is included.
+#
+: ${IU_TESTDIR:=$PWD/iu_inetd.XXXXXX}
+
+if [ ! -d "$IU_TESTDIR" ]; then
+    do_cleandir=true
+    IU_TESTDIR="`$MKTEMP -d "$IU_TESTDIR" 2>/dev/null`" ||
+       {
+           echo 'Failed at creating test directory.  Aborting.' >&2
+           exit 77
+       }
+elif expr X"$IU_TESTDIR" : X"\.\{1,2\}/\{0,1\}$" >/dev/null; then
+    # Eliminating directories: . ./ .. ../
+    echo 'Dangerous input for test directory.  Aborting.' >&2
+    exit 77
+fi
+
+# The INETD daemon uses two files in the present test.
+#
+CONF="$IU_TESTDIR"/inetd.conf
+PID="$IU_TESTDIR"/inetd.pid
+
+# Are we able to write in IU_TESTDIR?
+# This could happen with preset IU_TESTDIR.
+#
+touch "$CONF" || {
+    echo 'No write access in test directory.  Aborting.' >&2
+    exit 1
+}
+
+# Erase the temporary directory.
+#
+clean_testdir () {
+    if test -f "$PID" && kill -0 "`cat "$PID"`" >/dev/null 2>&1; then
+       kill "`cat "$PID"`" || kill -9 "`cat "$PID"`"
+    fi
+    if test -z "${NOCLEAN+no}" && $do_cleandir; then
+       rm -r -f "$IU_TESTDIR"
+    fi
+}
+
+# Write a fresh configuration file.  Port is input parameter.
+write_conf () {
+    # First argument is port number.  Node is fixed as localhost.
+    echo "localhost:$1 stream tcp4 nowait $USER $ADDRPEEK addrpeek addr" \
+       > $CONF
+}
+
+errno=0
+
+PORT=`expr 12347 + ${RANDOM:-$$} % 521`
+
+write_conf $PORT
+
+# The daemon is launched only once.
+#
+$INETD -p$PID $CONF
+
+# Allow for the service to settle.
+sleep 2
+
+if test ! -f $PID; then
+    echo >&2 "Inetd never started: missing the PID-file."
+    errno=1
+else
+    # Repeated SIGHUP testing, with modified port.
+    for nn in 1 2 3 4 5; do
+       # Check for response at chosen port.
+       $TELNET -c -E -K -4 localhost $PORT 2>/dev/null |
+           grep 'Your address is 127.0.0.1.' >/dev/null 2>&1 || errno=1
+
+       test $errno -eq 0 ||
+           { echo >&2 "Repetition $nn failed."; break; }
+
+       # Update with new port for next round.
+       PORT=`expr $PORT + 1 + ${RANDOM:-$$} % 521`
+       write_conf $PORT
+       kill -HUP `cat $PID`
+
+       # Allow for the service to settle.
+       sleep 1
+    done
+    $silence echo "Passed `expr $nn - 1` SIGHUP rounds."
+fi
+
+test $errno -ne 0 || $silence echo 'Successful testing.'
+
+clean_testdir
+
+exit $errno
diff --git a/tests/telnet-localhost.sh b/tests/telnet-localhost.sh
index 36293f1..37e19b1 100755
--- a/tests/telnet-localhost.sh
+++ b/tests/telnet-localhost.sh
@@ -132,8 +132,8 @@ trap posttesting EXIT HUP INT QUIT TERM
 PORT=`expr 4973 + ${RANDOM:-$$} % 973`
 
 cat > "$INETD_CONF" <<-EOF ||
-       $PORT stream tcp4 nowait $USER $ADDRPEEK addrpeek addr
-       $PORT stream tcp6 nowait $USER $ADDRPEEK addrpeek addr
+       $TARGET:$PORT stream tcp4 nowait $USER $ADDRPEEK addrpeek addr
+       $TARGET6:$PORT stream tcp6 nowait $USER $ADDRPEEK addrpeek addr
 EOF
     {
        echo 'Could not create configuration file for Inetd.  Aborting.' >&2
diff --git a/tests/utmp.sh b/tests/utmp.sh
index 79951cf..978b11e 100755
--- a/tests/utmp.sh
+++ b/tests/utmp.sh
@@ -39,7 +39,7 @@ errno=0
 if who >/dev/null 2>&1; then
     # Check that readutmp agrees with who(1),
     # limiting ourselves to at most three users.
-    for nn in `who | sed 's/ .*//; 3q;'`; do
+    for nn in `who | $SED 's/ .*//; 3q;'`; do
        $READUTMP $nn || errno=1
     done
 else

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

Summary of changes:
 ChangeLog                 |   11 +++
 tests/Makefile.am         |    2 +-
 tests/inetd.sh            |  163 +++++++++++++++++++++++++++++++++++++++++++++
 tests/telnet-localhost.sh |    4 +-
 tests/utmp.sh             |    2 +-
 5 files changed, 178 insertions(+), 4 deletions(-)
 create mode 100755 tests/inetd.sh


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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