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_8-193-g683e8b2


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_8-193-g683e8b2
Date: Sat, 10 Dec 2011 22:49:08 +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  683e8b2a7eceef34c48ac57bbf0007f6e0f91629 (commit)
      from  c310f1175dc34175bf0b38e8007dcb4412ff1df1 (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=683e8b2a7eceef34c48ac57bbf0007f6e0f91629


commit 683e8b2a7eceef34c48ac57bbf0007f6e0f91629
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Dec 10 23:47:51 2011 +0100

    Improve incident recovery in test scripts.

diff --git a/ChangeLog b/ChangeLog
index d7ce537..0a2d888 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-10  Mats Erik Andersson <address@hidden>
+
+       * tests/ftp-localhost.sh: Expand trapping to kill inetd process.
+       * tests/syslogd.sh: Likewise.
+       * tests/tftp.sh: Use a random testing directory and implement
+       cleanup in a trapping function.
+
 2011-12-09  Mats Erik Andersson <address@hidden>
 
        * telnet/Makefile.am (INCLUDES): Add $(NCURSES_INCLUDE) to list.
diff --git a/tests/ftp-localhost.sh b/tests/ftp-localhost.sh
index 37374e3..374d6b1 100755
--- a/tests/ftp-localhost.sh
+++ b/tests/ftp-localhost.sh
@@ -47,7 +47,14 @@ fi
 # all paths must be absolute for things to work.
 
 TMPDIR=`mktemp -d $PWD/tmp.XXXXXXXXXX`
-trap 'rm -rf "$TMPDIR"' 0 1 2 3 15
+
+posttesting () {
+    test -f "$TMPDIR/inetd.pid" -a -r "$TMPDIR/inetd.pid" \
+       && kill -9 "$(cat $TMPDIR/inetd.pid)"
+    rm -rf "$TMPDIR"
+}
+
+trap posttesting 0 1 2 3 15
 
 echo "4711 stream tcp nowait root $PWD/$FTPD ftpd -A -l" > $TMPDIR/inetd.conf
 echo "machine 127.0.0.1 login ftp password foobar" > $TMPDIR/.netrc
@@ -76,7 +83,4 @@ if ! grep 'FTP server status' $TMPDIR/ftp.stdout; then
     exit 1
 fi
 
-inetd_pid=`cat $TMPDIR/inetd.pid`
-kill -9 $inetd_pid
-
 exit 0
diff --git a/tests/syslogd.sh b/tests/syslogd.sh
index 86cd9fd..fac8545 100755
--- a/tests/syslogd.sh
+++ b/tests/syslogd.sh
@@ -58,6 +58,8 @@ clean_testdir () {
        if [ -z "${NOCLEAN+no}" -a "$IU_DO_CLEANDIR" = "yes" ]; then
                rm -fR $IU_TESTDIR
        fi
+       test -f "$PID" && ps "$(cat $PID)" >/dev/null 2>&1 \
+               && kill -9 "$(cat $PID)"
 }
 
 # Clean artifacts as execution stops.
diff --git a/tests/tftp.sh b/tests/tftp.sh
index 453e9e8..cf3be17 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -31,8 +31,22 @@ IFCONFIG="${IFCONFIG:-../ifconfig/ifconfig$EXEEXT 
--format=unix}"
 AF=${AF:-inet}
 PROTO=${PROTO:-udp}
 PORT=${PORT:-7777}
-INETD_CONF="$PWD/inetd.conf.tmp"
-INETD_PID="$PWD/inetd.pid.$$"
+
+# Random base diractory at testing time.
+TMPDIR=`mktemp -d $PWD/tmp.XXXXXXXXXX`
+INETD_CONF="$TMPDIR/inetd.conf.tmp"
+INETD_PID="$TMPDIR/inetd.pid.$$"
+
+posttesting () {
+    if test -f "$INETD_PID" -a -r "$INETD_PID" \
+       && ps "$(cat $INETD_PID)" >/dev/null 2>&1
+    then
+       kill -9 "$(cat $INETD_PID)"
+    fi
+    rm -rf "$TMPDIR" tftp-test-file
+}
+
+trap posttesting EXIT HUP INT QUIT TERM
 
 ADDRESSES="`$IFCONFIG | sed -e "/$AF /!d" \
      -e "s/^.*$AF[[:blank:]]\([:.0-9]\{1,\}\)[[:blank:]].*$/\1/g"`"
@@ -61,7 +75,7 @@ fi
 # name because `inetd' chdirs to `/' in daemon mode; ditto for
 # $INETD_CONF.
 cat > "$INETD_CONF" <<EOF
-$PORT dgram $PROTO wait $USER $TFTPD   tftpd -l `pwd`/tftp-test
+$PORT dgram $PROTO wait $USER $TFTPD   tftpd -l $TMPDIR/tftp-test
 EOF
 
 # Launch `inetd', assuming it's reachable at all $ADDRESSES.
@@ -89,9 +103,10 @@ else
     input="/dev/zero"
 fi
 
-rm -fr tftp-test tftp-test-file
-mkdir tftp-test && \
-    dd if="$input" of="tftp-test/tftp-test-file" bs=1024 count=170 2>/dev/null
+rm -fr $TMPDIR/tftp-test tftp-test-file
+mkdir -p $TMPDIR/tftp-test && \
+    dd if="$input" of="$TMPDIR/tftp-test/tftp-test-file" \
+       bs=1024 count=170 2>/dev/null
 
 echo "Looks into $ADDRESSES."
 
@@ -101,7 +116,7 @@ for addr in $ADDRESSES; do
     rm -f tftp-test-file
     echo "get tftp-test-file" | "$TFTP" $addr $PORT
 
-    cmp tftp-test/tftp-test-file tftp-test-file
+    cmp $TMPDIR/tftp-test/tftp-test-file tftp-test-file
     result=$?
 
     if [ "$result" -ne 0 ]; then
@@ -113,11 +128,7 @@ for addr in $ADDRESSES; do
     fi
 done
 
-ps "$inetd_pid" >/dev/null 2>&1 && kill "$inetd_pid"
-
-rm -rf tftp-test tftp-test-file "$INETD_CONF" "$INETD_PID"
-
-# Minimal clean up
+# Minimal clean up. Main work in posttesting().
 echo
 
 exit $result

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

Summary of changes:
 ChangeLog              |    7 +++++++
 tests/ftp-localhost.sh |   12 ++++++++----
 tests/syslogd.sh       |    2 ++
 tests/tftp.sh          |   35 +++++++++++++++++++++++------------
 4 files changed, 40 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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