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-48-g590fde


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-48-g590fde5
Date: Thu, 01 Mar 2012 23:02:17 +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  590fde5934de486865b0eee54e4f1a93de2a549b (commit)
       via  04707b5698de3551bba9f9bcedc9414397b6f5ed (commit)
       via  c2ca330865bc9794086dc334b1659d1d1caba84a (commit)
      from  8173030af23ddb67c3834c79226c17a5f8175c6e (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=590fde5934de486865b0eee54e4f1a93de2a549b


commit 590fde5934de486865b0eee54e4f1a93de2a549b
Author: Mats Erik Andersson <address@hidden>
Date:   Thu Mar 1 23:33:22 2012 +0100

    Tests for configuration reload.
    
    Expand two test scripts to capture reactions of
    inetd and syslogd to SIGHUP signals.

diff --git a/ChangeLog b/ChangeLog
index 1b48ecd..207eb84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2012-03-01  Mats Erik Andersson <address@hidden>
 
+       Subtests for SIGHUP reaction of `inetd' and `syslogd'.
+
+       * tests/syslogd.sh: Write a second configuration file after first run,
+       send SIGHUP to server, and evaluate message response.
+       (SUCCESSES): Update arithmetic expression used in evaluation.
+       (OUT_USER, OUT_DEBUG, TAG2, COUNT2, COUNT2_debug, COUNT3, COUNT3_info):
+       New variables.
+       <verbose report>: Print messages of files $OUT_USER and $OUT_DEBUG.
+
+       * tests/tftp.sh: Calculate new port after first test run, send SIGHUP
+       to server, and transmit a small file at each adress in old list.
+       (do_conf_reload): New variable.
+
+2012-03-01  Mats Erik Andersson <address@hidden>
+
        Reduce external prerequisites in test scripts.
        * tests/ftp-localhost.sh: Replace `head -1' by `sed 1q'.
        * tests/telnet-localhost.sh, tests/tftp.sh: Likewise.  Replace `ps pid'
diff --git a/tests/syslogd.sh b/tests/syslogd.sh
index 64c3912..3a719e4 100755
--- a/tests/syslogd.sh
+++ b/tests/syslogd.sh
@@ -400,6 +400,47 @@ if $do_inet_socket; then
        "Sending IPv6 message. (pid $$)"
 fi
 
+# Generate a more elaborate message routing, aimed at confirming
+# discrimination of severity and facility.  This is made active
+# by sending SIGHUP to the server process.
+#
+OUT_USER="$IU_TESTDIR"/user.log
+OUT_DEBUG="$IU_TESTDIR"/debug.log
+
+# Create the new files to avoid false negatives.
+: > "$OUT_USER"
+: > "$OUT_DEBUG"
+
+cat > "$CONF" <<-EOT
+       *.*;user.none   $OUT
+       user.info       $OUT_USER
+       *.=debug        $OUT_DEBUG
+EOT
+
+# Use another tag for better discrimination.
+TAG2="syslogd-reload-test"
+
+# Load the new configuration
+kill -HUP `cat "$PID"`
+
+if $do_unix_socket; then
+    # Two messages, but absence is also awarded credit.
+    TESTCASES=`expr $TESTCASES + 4`
+    $LOGGER -h "$SOCKET" -p user.info -t "$TAG2" \
+       "user.info as BSD message. (pid $$)"
+    $LOGGER -h "$SOCKET" -p user.debug -t "$TAG2" \
+       "user.debug as BSD message. (pid $$)"
+fi
+
+if $do_inet_socket; then
+    # Two messages, but absence is also awarded credit.
+    TESTCASES=`expr $TESTCASES + 4`
+    $LOGGER -4 -h "$TARGET:$PORT" -p user.info -t "$TAG2" \
+       "user.info IPv4 message. (pid $$)"
+    $LOGGER -4 -h "$TARGET:$PORT" -p user.debug -t "$TAG2" \
+       "user.debug as IPv4 message. (pid $$)"
+fi
+
 # Remove previous SYSLOG daemon.
 test -r "$PID" && kill -0 "`cat "$PID"`" >/dev/null 2>&1 &&
     kill "`cat "$PID"`"
@@ -435,14 +476,24 @@ sleep 1
 # Detection of registered messages.
 #
 COUNT=`grep -c "$TAG" "$OUT"`
-SUCCESSES=`expr $SUCCESSES + $COUNT`
+COUNT2=`grep -c "$TAG2" "$OUT_USER"`
+COUNT2_debug=`grep -c "$TAG2.*user.debug" "$OUT_USER"`
+COUNT3=`grep -c "$TAG2" "$OUT_DEBUG"`
+COUNT3_info=`grep -c "$TAG2.*user.info" "$OUT_DEBUG"`
+SUCCESSES=`expr $SUCCESSES + $COUNT + 2 \* $COUNT2 - $COUNT2_debug \
+               + 2 \* $COUNT3 - $COUNT3_info`
 
 if [ -n "${VERBOSE+yes}" ]; then
     cat <<-EOT
        ---------- Successfully detected messages. ----------
        `grep "$TAG" "$OUT"`
+       `grep -h "$TAG2" "$OUT_USER" "$OUT_DEBUG"`
        ---------- Full message log for syslogd. ------------
        `cat "$OUT"`
+       ---------- User message log. ------------------------
+       `cat "$OUT_USER"`
+       ---------- Debug message log. -----------------------
+       `cat "$OUT_DEBUG"`
        -----------------------------------------------------
        EOT
 fi
diff --git a/tests/tftp.sh b/tests/tftp.sh
index 38713b3..ecea59b 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -96,6 +96,9 @@ AF=${AF:-inet}
 PROTO=${PROTO:-udp}
 USER=`id -u -n`
 
+# Late supplimentary subtest.
+do_conf_reload=true
+
 # Random base directory at testing time.
 TMPDIR=`mktemp -d $PWD/tmp.XXXXXXXXXX` ||
     {
@@ -324,6 +327,52 @@ for addr in $ADDRESSES; do
    done
 done
 
+# Test the ability of inetd to reload configuration:
+#
+# Assign a new port in the configuration file. Send SIGHUP
+# to inetd and check whether transmission of the small
+# file used previously still succeeds.
+#
+PORT=`expr $PORT + 1 + ${RANDOM:-$$} % 521`
+
+locate_port $PROTO $PORT &&
+    {
+       # Try a second port.
+       PORT=`expr $PORT + 97 + ${RANDOM:-$$} % 479`
+       # Disable subtest if still no free port.
+       locate_port $PROTO $PORT && do_conf_reload=false
+    }
+
+echo
+
+if $do_conf_reload; then
+    echo >&2 'Testing altered and reloaded configuration.'
+    write_conf ||
+       {
+           echo >&2 'Could not rewrite configuration file for Inetd.  Failing.'
+           exit 1
+       }
+
+    kill -HUP $inetd_pid
+    name=`echo "$FILELIST" | sed 's/ .*//'`
+    for addr in $ADDRESSES; do
+       EFFORTS=`expr $EFFORTS + 1`
+       test -f "$name" && rm "$name"
+       echo "get $name" | "$TFTP" ${VERBOSE+-v} "$addr" $PORT
+       cmp "$TMPDIR/tftp-test/$name" "$name" 2>/dev/null
+       result=$?
+       if test $result -ne 0; then
+           test -z "$VERBOSE" || echo >&2 "Failed comparison for $addr/$name."
+           RESULT=$result
+       else
+           SUCCESSES=`expr $SUCCESSES + 1`
+           test -z "$VERBOSE" || echo >&2 "Success at new port for 
$addr/$name."
+       fi
+    done
+else
+    echo >&2 'Informational: Inhibiting config reload test.'
+fi
+
 # Minimal clean up. Main work in posttesting().
 echo
 echo Tests in $0 had $SUCCESSES successes out of $EFFORTS cases.

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=04707b5698de3551bba9f9bcedc9414397b6f5ed


commit 04707b5698de3551bba9f9bcedc9414397b6f5ed
Author: Mats Erik Andersson <address@hidden>
Date:   Thu Mar 1 23:08:26 2012 +0100

    Reduce test script prerequisites.

diff --git a/ChangeLog b/ChangeLog
index c9525b9..1b48ecd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-03-01  Mats Erik Andersson <address@hidden>
+
+       Reduce external prerequisites in test scripts.
+       * tests/ftp-localhost.sh: Replace `head -1' by `sed 1q'.
+       * tests/telnet-localhost.sh, tests/tftp.sh: Likewise.  Replace `ps pid'
+       by `kill -0 pid'.
+       * tests/syslogd.sh: Likewise.  Replace `wc -l' by `grep -c'.
+
+       * tests/tftp.sh: Do not issue `set -m', since no job control in use.
+
 2012-02-25  Alfred M. Szmidt  <address@hidden>
 
        * bootstrap.conf (gnulib_modules): Sort lexically.
diff --git a/tests/ftp-localhost.sh b/tests/ftp-localhost.sh
index 6d22d35..1122e41 100755
--- a/tests/ftp-localhost.sh
+++ b/tests/ftp-localhost.sh
@@ -23,9 +23,7 @@
 #
 #  * Shell: SVR4 Bourne shell, or newer.
 #
-#  * cat(1), chmod(1), head(1), kill(1), rm(1).
-#
-#  * id(1), grep(1), mktemp(1), netstat(8), sed(1), uname(1).
+#  * chmod(1), id(1), kill(1), mktemp(1), netstat(8), uname(1).
 #
 #  * Detection of sysctl(8) is made.  Availability will
 #    lead to better test coverage.
@@ -111,9 +109,9 @@ fi
 
 if [ $VERBOSE ]; then
     set -x
-    $FTP --version | head -1
-    $FTPD --version | head -1
-    $INETD --version | head -1
+    $FTP --version | sed '1q'
+    $FTPD --version | sed '1q'
+    $INETD --version | sed '1q'
 fi
 
 if [ `id -u` != 0 ]; then
diff --git a/tests/syslogd.sh b/tests/syslogd.sh
index add498c..64c3912 100755
--- a/tests/syslogd.sh
+++ b/tests/syslogd.sh
@@ -25,9 +25,7 @@
 #
 #  * Shell: SVR4 Bourne shell, or newer.
 #
-#  * cat(1), expr(1), head(1), kill(1), pwd(1), rm(1), rmdir(1).
-#
-#  * id(1), grep(1), mktemp(1), netstat(8), ps(1), touch(1), uname(1).
+#  * id(1), kill(1), mktemp(1), netstat(8), uname(1).
 
 
 # Is usage explanation in demand?
@@ -93,8 +91,8 @@ LOGGER=${LOGGER:-../src/logger$EXEEXT}
 
 if [ $VERBOSE ]; then
     set -x
-    $SYSLOGD --version | head -1
-    $LOGGER --version | head -1
+    $SYSLOGD --version | sed '1q'
+    $LOGGER --version | sed '1q'
 fi
 
 if [ ! -x $SYSLOGD ]; then
@@ -159,7 +157,7 @@ fi
 # Erase the testing directory.
 #
 clean_testdir () {
-    if test -f "$PID" && ps "`cat "$PID"`" >/dev/null 2>&1; then
+    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
@@ -403,7 +401,7 @@ if $do_inet_socket; then
 fi
 
 # Remove previous SYSLOG daemon.
-test -r "$PID" && ps "`cat "$PID"`" >/dev/null 2>&1 &&
+test -r "$PID" && kill -0 "`cat "$PID"`" >/dev/null 2>&1 &&
     kill "`cat "$PID"`"
 
 # Check functionality of standard port, i.e., execution
@@ -436,7 +434,7 @@ sleep 1
 
 # Detection of registered messages.
 #
-COUNT=`grep "$TAG" "$OUT" | wc -l`
+COUNT=`grep -c "$TAG" "$OUT"`
 SUCCESSES=`expr $SUCCESSES + $COUNT`
 
 if [ -n "${VERBOSE+yes}" ]; then
@@ -465,7 +463,7 @@ else
 fi
 
 # Remove the daemon process.
-test -r "$PID" && ps "`cat "$PID"`" >/dev/null 2>&1 &&
+test -r "$PID" && kill -0 "`cat "$PID"`" >/dev/null 2>&1 &&
     kill "`cat "$PID"`"
 
 exit $EXITCODE
diff --git a/tests/telnet-localhost.sh b/tests/telnet-localhost.sh
index 01cac1e..49f8614 100755
--- a/tests/telnet-localhost.sh
+++ b/tests/telnet-localhost.sh
@@ -25,9 +25,12 @@
 #
 #  * Shell: SVR4 Bourne shell, or newer.
 #
-#  * cat(1), expr(1), head(1), kill(1), pwd(1), rm(1).
+#  * id(1), kill(1), mktemp(1), tty(1).
 #
-#  * id(1), grep(1), mktemp(1), ps(1), tty(1).
+#  * Accessed by launched Inetd:
+#      /etc/nsswitch.conf, /etc/passwd, /etc/protocols.
+#
+#    OpenBSD uses /etc/services directly, not via /etc/nsswitch.conf.
 
 # Is usage explanation in demand?
 #
@@ -63,8 +66,8 @@ test -d src && test -f tests/telnet-localhost.sh && cd tests/
 
 if test -n "$VERBOSE"; then
     set -x
-    $INETD --version | head -1
-    $TELNET --version | head -1
+    $INETD --version | sed '1q'
+    $TELNET --version | sed '1q'
 fi
 
 # The use of telnet is portable only with a connected TTY.
@@ -111,7 +114,7 @@ INETD_PID="$TMPDIR/inetd.pid.$$"
 posttesting () {
     if test -n "$TMPDIR" && test -f "$INETD_PID" \
        && test -r "$INETD_PID" \
-       && ps "`cat $INETD_PID`" >/dev/null 2>&1
+       && kill -0 "`cat $INETD_PID`" >/dev/null 2>&1
     then
        kill "`cat $INETD_PID`" >/dev/null 2>&1 ||
        kill -9 "`cat $INETD_PID`" >/dev/null 2>&1
diff --git a/tests/tftp.sh b/tests/tftp.sh
index 2c2f4ee..38713b3 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -21,21 +21,15 @@
 
 # Prerequisites:
 #
-#  * Shell: SVR4 Bourne shell, or newer, and allowing job control.
+#  * Shell: SVR4 Bourne shell, or newer.
 #
-#  * cat(1), expr(1), head(1), kill(1), pwd(1), rm(1).
-#
-#  * cmp(1), dd(1), id(1), grep(1), mktemp(1), netstat(8),
-#    ps(1), sed(1), uname(1).
+#  * dd(1), id(1), kill(1), mktemp(1), netstat(8), uname(1).
 #
 #  * Accessed by launched Inetd:
 #      /etc/nsswitch.conf, /etc/passwd, /etc/protocols.
 #
 #    OpenBSD uses /etc/services directly, not via /etc/nsswitch.conf.
 
-# Need job control when spawning Inetd.
-set -m
-
 if [ "$VERBOSE" ]; then
     set -x
 fi
@@ -115,7 +109,7 @@ INETD_PID="$TMPDIR/inetd.pid.$$"
 posttesting () {
     if test -n "$TMPDIR" && test -f "$INETD_PID" \
        && test -r "$INETD_PID" \
-       && ps "`cat $INETD_PID`" >/dev/null 2>&1
+       && kill -0 "`cat $INETD_PID`" >/dev/null 2>&1
     then
        kill "`cat $INETD_PID`" 2>/dev/null ||
        kill -9 "`cat $INETD_PID`" 2>/dev/null
@@ -154,10 +148,10 @@ locate_port () {
 }
 
 if [ "$VERBOSE" ]; then
-    "$TFTP" --version | head -1
-    "$TFTPD" --version | head -1
-    "$INETD" --version | head -1
-    "$IFCONFIG_SIMPLE" --version | head -1
+    "$TFTP" --version | sed '1q'
+    "$TFTPD" --version | sed '1q'
+    "$INETD" --version | sed '1q'
+    "$IFCONFIG_SIMPLE" --version | sed '1q'
 fi
 
 # Find an available port number.  There will be some
@@ -229,7 +223,7 @@ sleep 1
 locate_port $PROTO $PORT
 if test $? -ne 0; then
     # No it did not.
-    ps "$inetd_pid" >/dev/null 2>&1 && kill -9 "$inetd_pid" 2>/dev/null
+    kill -0 "$inetd_pid" >/dev/null 2>&1 && kill -9 "$inetd_pid" 2>/dev/null
     rm -f "$INETD_PID"
 
     echo 'First attempt at starting Inetd has failed.' >&2
@@ -255,7 +249,7 @@ if test $? -ne 0; then
                but loosing control whether an Inetd process is
                still around.
                EOT
-           ps "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 
2>/dev/null
+           kill -0 "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 
2>/dev/null
            exit 1
        }
 
@@ -265,7 +259,7 @@ if test $? -ne 0; then
        : # Successful this time.
     else
        echo "Failed again at starting correct Inetd instance." >&2
-       ps "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 2>/dev/null
+       kill -0 "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 
2>/dev/null
        exit 1
     fi
 fi

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=c2ca330865bc9794086dc334b1659d1d1caba84a


commit c2ca330865bc9794086dc334b1659d1d1caba84a
Author: Mats Erik Andersson <address@hidden>
Date:   Thu Mar 1 22:13:02 2012 +0100

    Revert removal of header inclusion. (silent change)

diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
index 22f1a96..d844d37 100644
--- a/telnetd/telnetd.c
+++ b/telnetd/telnetd.c
@@ -28,6 +28,10 @@
 #include <error.h>
 #include <libinetutils.h>
 
+#if defined AUTHENTICATION || defined ENCRYPTION
+# include <libtelnet/misc.h>
+#endif
+
 static void parse_authmode (char *str);
 static void parse_linemode (char *str);
 static void parse_debug_level (char *str);

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

Summary of changes:
 ChangeLog                 |   25 +++++++++++++++
 telnetd/telnetd.c         |    4 ++
 tests/ftp-localhost.sh    |   10 ++---
 tests/syslogd.sh          |   69 +++++++++++++++++++++++++++++++++++------
 tests/telnet-localhost.sh |   13 +++++---
 tests/tftp.sh             |   75 +++++++++++++++++++++++++++++++++++---------
 6 files changed, 159 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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