[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_8-196-gae08f03
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_8-196-gae08f03 |
Date: |
Tue, 13 Dec 2011 00:34:37 +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 ae08f03b3de1101120aaf287ceb6f7b63981968a (commit)
from 2106a3ea5028ac3d2c84503a0b89a66de5c6d5e2 (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=ae08f03b3de1101120aaf287ceb6f7b63981968a
commit ae08f03b3de1101120aaf287ceb6f7b63981968a
Author: Mats Erik Andersson <address@hidden>
Date: Tue Dec 13 00:11:37 2011 +0100
tests/tftp.sh: Better testing coverage.
Several payload sizes; adaptions for Solaris.
Test only 127.0.0.1 by default, but configurable.
diff --git a/ChangeLog b/ChangeLog
index 86e02dd..c8f960c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-13 Mats Erik Andersson <address@hidden>
+
+ * tests/tftp.sh: Subtests for differing data transfer size.
+ Portability fix for Solaris.
+
2011-12-11 Mats Erik Andersson <address@hidden>
* tests/ftp-localhost.sh: Use strict IPv4 options for portability.
diff --git a/tests/tftp.sh b/tests/tftp.sh
index cf3be17..0f9c6c0 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -19,6 +19,8 @@
# Run `inetd' with `tftpd' and try to fetch a file from there using `tftp'.
+# FIXME: Presently tailored for IPv4.
+
if [ "$VERBOSE" ]; then
set -x
fi
@@ -31,6 +33,7 @@ IFCONFIG="${IFCONFIG:-../ifconfig/ifconfig$EXEEXT
--format=unix}"
AF=${AF:-inet}
PROTO=${PROTO:-udp}
PORT=${PORT:-7777}
+USER=${USER:-$LOGNAME}
# Random base diractory at testing time.
TMPDIR=`mktemp -d $PWD/tmp.XXXXXXXXXX`
@@ -43,13 +46,23 @@ posttesting () {
then
kill -9 "$(cat $INETD_PID)"
fi
- rm -rf "$TMPDIR" tftp-test-file
+ rm -rf "$TMPDIR" $FILELIST
}
trap posttesting EXIT HUP INT QUIT TERM
-ADDRESSES="`$IFCONFIG | sed -e "/$AF /!d" \
- -e "s/^.*$AF[[:blank:]]\([:.0-9]\{1,\}\)[[:blank:]].*$/\1/g"`"
+# Use only "127.0.0.1" as default address list.
+# Other configured addresses might be set under
+# strict filter policies, thus might block.
+#
+# Allow a setting "ADDRESSES=sense" to compute the
+# available addresses and then to test them all.
+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"`"
+fi
# Check that netstat works before proceeding.
netstat -na > /dev/null
@@ -58,6 +71,18 @@ if [ ! $? -eq 0 ]; then
exit 77
fi
+# Work around the peculiar output of netstat(1m,solaris).
+#
+# locate_port family proto port
+#
+locate_port () {
+ if [ "$(uname -s)" = "SunOS" ]; then
+ netstat -na -f$1 -P$2 | grep -q -E "\.$3[^0-9]"
+ else
+ netstat -na | grep -q -E "^$2(4|6|46)?.*[^0-9]$3[^0-9]"
+ fi
+}
+
if [ "$VERBOSE" ]; then
"$TFTP" --version
"$TFTPD" --version
@@ -65,7 +90,7 @@ if [ "$VERBOSE" ]; then
fi
# Check that the port is still available
-netstat -na | grep -q -E "^$PROTO(4|6|46)?.*[^0-9]$PORT[^0-9]"
+locate_port inet $PROTO $PORT
if test $? -eq 0; then
echo "Desired port $PORT/$PROTO is already in use."
exit 77
@@ -75,7 +100,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 $TMPDIR/tftp-test
+$PORT dgram ${PROTO}4 wait $USER $TFTPD tftpd -l $TMPDIR/tftp-test
EOF
# Launch `inetd', assuming it's reachable at all $ADDRESSES.
@@ -89,7 +114,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 -q -E "^$PROTO(4|6|46)?.*[^0-9]$PORT[^0-9]"
+locate_port inet $PROTO $PORT
if test $? -ne 0; then
# No it did not.
ps "$inetd_pid" >/dev/null 2>&1 && kill "$inetd_pid"
@@ -103,32 +128,59 @@ else
input="/dev/zero"
fi
-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
+rm -fr $TMPDIR/tftp-test tftp-test-file*
+mkdir -p $TMPDIR/tftp-test
-echo "Looks into $ADDRESSES."
+# It is important to test data of differing sizes.
+#
+# Input format:
+#
+# name block-size count
+
+FILEDATA="file-small 320 1
+file-medium 320 2
+tftp-test-file 1024 170
+"
+
+echo "$FILEDATA" |
+while read name bsize count; do
+ test -z "$name" && continue
+ dd if="$input" of="$TMPDIR/tftp-test/$name" \
+ bs=$bsize count=$count 2>/dev/null
+done
-for addr in $ADDRESSES; do
- echo "trying with address \`$addr'..." >&2
+FILELIST="$(echo "$FILEDATA" | sed 's/[[:space:]].*//' | tr "\n" ' ')"
- rm -f tftp-test-file
- echo "get tftp-test-file" | "$TFTP" $addr $PORT
+SUCCESSES=0
+EFFORTS=0
+RESULT=0
- cmp $TMPDIR/tftp-test/tftp-test-file tftp-test-file
- result=$?
+echo "Looking into \"$(echo $ADDRESSES | tr "\n" " ")\"."
- if [ "$result" -ne 0 ]; then
- # Failure.
- test -z "$VERBOSE" || echo "Failed comparison for $addr." >&2
- break
- else
- test -z "$VERBOSE" || echo "Successful comparison for $addr." >&2
- fi
+for addr in $ADDRESSES; do
+ echo "trying with address \`$addr'..." >&2
+
+ for name in $FILELIST; do
+ EFFORTS=$((EFFORTS + 1))
+ rm -f $name
+ echo "get $name" | "$TFTP" $addr $PORT
+
+ cmp "$TMPDIR/tftp-test/$name" "$name"
+ result=$?
+
+ if [ "$result" -ne 0 ]; then
+ # Failure.
+ test -z "$VERBOSE" || echo "Failed comparison for $addr/$name." >&2
+ RESULT=$result
+ else
+ SUCCESSES=$((SUCCESSES + 1))
+ test -z "$VERBOSE" || echo "Successful comparison for $addr/$name."
>&2
+ fi
+ done
done
# Minimal clean up. Main work in posttesting().
echo
+echo Tests in $0 had $SUCCESSES successes out of $EFFORTS cases.
-exit $result
+exit $RESULT
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++
tests/tftp.sh | 102 +++++++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 82 insertions(+), 25 deletions(-)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_8-196-gae08f03,
Mats Erik Andersson <=