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_2-34-gd7139b


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_2-34-gd7139b7
Date: Sat, 02 Aug 2014 20:14:11 +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  d7139b7ea8ee6a9c9751aaab6d23c328f590a974 (commit)
      from  2a7913b37551105ab311464a11eb6edd31919610 (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=d7139b7ea8ee6a9c9751aaab6d23c328f590a974


commit d7139b7ea8ee6a9c9751aaab6d23c328f590a974
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Aug 2 21:37:00 2014 +0200

    More tests for more code coverage.

diff --git a/ChangeLog b/ChangeLog
index 4651155..b625209 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2014-08-02  Mats Erik Andersson  <address@hidden>
+
+       More tests for better code coverage.
+
+       * tests/Makefile.am [ENABLE_libls] (dist_check_SCRIPTS):
+       Add `libls.sh'.
+       [ENABLE_ftp] (dist_check_SCRIPTS): Add `ftp-parser.sh'.
+       * tests/ftp-parser.sh: New script.
+       * tests/ifconfig.sh: Add more test cases.
+       * tests/libls.sh: New script.
+
+       * ifconfig/options.c (formats): Add format `?' as a synonym
+       for format `help'.
+
 2014-08-01  Mats Erik Andersson  <address@hidden>
 
        ping, ping6: Repair pattern production.
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 2c18ac8..b301111 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -195,6 +195,10 @@ struct format formats[] = {
    "${index?}{}"
    "{${error}{${progname}: error: interface `${name}' does not exist${\\n}}"
    "${exit}{1}}"},
+  {"?",
+   "Synonym for `help'.",
+   "${format}{help}"
+  },
   {"help",
    "Display this help output.",
    "${foreachformat}{"
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 014af85..5490189 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,6 +26,8 @@ identify_LDADD =
 
 check_PROGRAMS = localhost readutmp waitdaemon
 
+dist_check_SCRIPTS = utmp.sh
+
 if ENABLE_inetd
 check_PROGRAMS += addrpeek tcpget
 endif
@@ -33,9 +35,9 @@ endif
 if ENABLE_libls
 noinst_PROGRAMS += ls
 ls_LDADD = $(LIBLS) $(iu_LIBRARIES)
+dist_check_SCRIPTS += libls.sh
 endif
 
-dist_check_SCRIPTS = utmp.sh
 if ENABLE_ping
 dist_check_SCRIPTS += ping-localhost.sh
 endif
@@ -55,6 +57,10 @@ dist_check_SCRIPTS += syslogd.sh
 endif
 endif
 
+if ENABLE_ftp
+dist_check_SCRIPTS += ftp-parser.sh
+endif
+
 if ENABLE_inetd
 if ENABLE_ftp
 if ENABLE_ftpd
diff --git a/tests/ftp-parser.sh b/tests/ftp-parser.sh
new file mode 100755
index 0000000..cec2121
--- /dev/null
+++ b/tests/ftp-parser.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+# Copyright (C) 2014 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/'.
+
+# Exercise the internal command interpreter of `ftp',
+# without any networking.  Intended for code coverage
+# testing.
+
+set -u
+
+. ./tools.sh
+
+: ${EXEEXT:=}
+silence=
+bucket=
+
+# Executable under test.
+#
+FTP=${FTP:-../ftp/ftp$EXEEXT}
+
+if test ! -x "$FTP"; then
+    echo >&2 "Missing executable '$FTP'.  Skipping test."
+    exit 77
+fi
+
+if test -z "${VERBOSE+set}"; then
+    silence=:
+    bucket='>/dev/null'
+fi
+
+if test -n "${VERBOSE:-}"; then
+    set -x
+    $FTP --version | $SED '1q'
+fi
+
+errno=0
+
+# Check that a client is not connected.
+#
+reply=`echo 'cd /tmp' | $FTP | $GREP -cv 'Not connected\.'`
+test $reply -eq 0 || { errno=1
+  echo >&2 'Failed respond to missing connection.'; }
+
+# Check that help is plentiful.
+#
+reply=`echo help | $FTP | $SED -n '$='`
+test $reply -ge 18 || { errno=1
+  echo >&2 'Unexpectedly short help listing.'; }
+
+# Check change from passive mode to active mode.
+#
+reply=`echo passive | $FTP -p | $GREP -cv 'Passive mode off\.'`
+test $reply -eq 0 || { errno=1
+  echo >&2 'Failed while switching back to active mode.'; }
+
+# Check address mode.
+reply=`echo ipv4 | $FTP --ipv6 | $GREP -cv 'Selecting addresses: IPv4'`
+test $reply -eq 0 || { errno=1
+  echo >&2 'Failed to reset address family by command.'; }
+
+# Step size for hash markers.
+#
+tell='hash 7M
+hash 12k'
+reply=`echo "$tell" | $FTP -v | $GREP -c -e 12288 -e 7340032`
+
+test $reply -eq 2 || { errno=1
+  echo >&2 'Failed to parse step sizes for hash printing.'; }
+
+# A set of mixed commands for the sake of code coverage.
+#
+tell='bell
+case
+hash
+nmap
+runique
+sunique
+epsv4
+lcd /tmp
+lpwd'
+reply=`echo "$tell" | $FTP`
+
+test `echo "$reply" | $SED -n '$='` \
+     -eq `echo "$tell" | $SED -n '$='` \
+&& test `echo "$reply" | $GREP -c 'Local directory is /tmp'` -eq 1 \
+|| { errno=1; echo >&2 'Failed to set local directory.'; }
+
+# Summary of work.
+#
+test $errno -ne 0 || $silence echo "Successful testing".
+
+exit $errno
diff --git a/tests/ifconfig.sh b/tests/ifconfig.sh
index d5820f9..bc34e6c 100755
--- a/tests/ifconfig.sh
+++ b/tests/ifconfig.sh
@@ -48,11 +48,10 @@ fi
 
 . ./tools.sh
 
-# Executable uder test.
+# Executable under test.
 #
 IFCONFIG=${IFCONFIG:-../ifconfig/ifconfig$EXEEXT}
 
-
 if test ! -x "$IFCONFIG"; then
     echo >&2 "Missing executable '$IFCONFIG'.  Skipping test."
     exit 77
@@ -92,14 +91,38 @@ find_lo_addr () {
 
 errno=0
 
+# Check for loopback address in all formats displaying the
+# standard address 127.0.0.1.
+#
 for fmt in ${FORMAT:-gnu gnu-one-entry net-tools osf unix}; do
     $silence echo "Checking format $fmt."
     find_lo_addr $fmt || { errno=1; echo >&2 "Failed with format '$fmt'."; }
 done
 
+# Check that all listed adapters are responding affirmatively
+# to all formats, but discard all output.
+#
+for fmt in check default gnu gnu-one-entry netstat net-tools osf unix
+do
+    for iface in $IF_LIST; do
+       $IFCONFIG --format=$fmt -i $iface >/dev/null ||
+           { errno=1;
+             echo >&2 "Failed with format '$fmt', adapter '$iface'."
+           }
+    done
+done
+
+# Check that short format and full printout succeed; discard output.
+#
+$IFCONFIG --short >/dev/null ||
+    { errno=1; echo >&2 'Failed with short format.'; }
+
+$IFCONFIG --all >/dev/null ||
+    { errno=1; echo >&2 'Failed while listing all.'; }
+
 # Informational check whether the legacy form use
 # is implemented.  No error produced, only message.
-
+#
 if $IFCONFIG $LO >/dev/null 2>&1; then
     :
 else
diff --git a/tests/libls.sh b/tests/libls.sh
new file mode 100755
index 0000000..a8ed8eb
--- /dev/null
+++ b/tests/libls.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+# Copyright (C) 2014 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/'.
+
+# Check response in libls.
+# Very simple testing, aiming mostly at code coverage.
+
+set -u
+
+. ./tools.sh
+
+: ${EXEEXT:=}
+silence=
+bucket=
+
+# Executable under test.
+#
+LS=${LS:-./ls$EXEEXT}
+
+if test ! -x "$LS"; then
+    echo >&2 "Missing executable '$LS'.  Skipping test."
+    exit 77
+fi
+
+if test -z "${VERBOSE+set}"; then
+    silence=:
+    bucket='>/dev/null'
+fi
+
+# Several runs with different switches are compared by
+# a simple count of printed lines.
+#
+REPLY_a1=`$LS -a1 | $SED -n '$='`
+REPLY_A1=`$LS -A1 | $SED -n '$='`
+
+REPLY_C=`$LS -C`
+REPLY_Cf=`$LS -Cf`
+REPLY_Cr=`$LS -Cr`
+REPLY_Ct=`$LS -Ct`
+REPLY_x=`$LS -x`
+REPLY_m=`$LS -m`
+
+REPLY_l=`$LS -l`
+REPLY_lT=`$LS -l`
+REPLY_n=`$LS -n`
+
+# In an attempt to counteract lack of subsecond accuracy,
+# probe the parent directory where timing is known to be more
+# varied, than in the subdirectory "tests/".
+#
+REPLY_Ccts=`$LS -Ccts ..`
+REPLY_Cuts=`$LS -Cuts ..`
+
+errno=0
+
+test $REPLY_a1 -eq `expr $REPLY_A1 + 2` ||
+  { errno=1; echo >&2 'Failed to suppress "." and "..".'; }
+
+test x"$REPLY_C" != x"$REPLY_Cf" ||
+  { errno=1; echo >&2 'Failed to disable sorting with "-f".'; }
+
+test x"$REPLY_C" != x"$REPLY_Cr" ||
+  { errno=1; echo >&2 'Failed to reverse sorting with "-r".'; }
+
+test x"$REPLY_C" != x"$REPLY_Ct" ||
+  { errno=1; echo >&2 'Failed to sort on modification with "-t".'; }
+
+test x"$REPLY_C" != x"$REPLY_x" ||
+  { errno=1; echo >&2 'Failed to distinguish "-C" from "-x".'; }
+
+test x"$REPLY_C" != x"$REPLY_m" ||
+  { errno=1; echo >&2 'Failed to distinguish "-C" from "-m".'; }
+
+test x"$REPLY_l" != x"$REPLY_n" ||
+  { errno=1; echo >&2 'Failed to distinguish "-l" from "-n".'; }
+
+test x"$REPLY_Ccts" != x"$REPLY_Cuts" ||
+  { errno=1; echo >&2 'Failed to distinguish "-u" from "-c".'; }
+
+test $errno -ne 0 || $silence echo "Successful testing".
+
+exit $errno

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

Summary of changes:
 ChangeLog           |   14 +++++++
 ifconfig/options.c  |    4 ++
 tests/Makefile.am   |    8 +++-
 tests/ftp-parser.sh |  107 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ifconfig.sh   |   29 ++++++++++++-
 tests/libls.sh      |   97 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 255 insertions(+), 4 deletions(-)
 create mode 100755 tests/ftp-parser.sh
 create mode 100755 tests/libls.sh


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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