INN commit: trunk (14 files)

INN Commit rra at isc.org
Tue Jan 23 20:35:52 UTC 2018


    Date: Tuesday, January 23, 2018 @ 12:35:52
  Author: iulius
Revision: 10221

Update to latest C TAP Harness and rra-c-util upstream versions

Modified:
  trunk/include/clibrary.h
  trunk/support/getc-tap-harness
  trunk/support/getrra-c-util
  trunk/tests/README
  trunk/tests/docs/pod.t
  trunk/tests/lib/asprintf-t.c
  trunk/tests/lib/network/server-t.c
  trunk/tests/runtests.c
  trunk/tests/tap/basic.c
  trunk/tests/tap/basic.h
  trunk/tests/tap/float.c
  trunk/tests/tap/float.h
  trunk/tests/tap/libtap.sh
  trunk/tests/tap/macros.h

------------------------------+
 include/clibrary.h           |    6 ++--
 support/getc-tap-harness     |   14 ++++-----
 support/getrra-c-util        |    2 -
 tests/README                 |    2 +
 tests/docs/pod.t             |    4 ++
 tests/lib/asprintf-t.c       |    5 ++-
 tests/lib/network/server-t.c |   30 ++++++++++++++-------
 tests/runtests.c             |   58 ++++++++++++++++++++++-------------------
 tests/tap/basic.c            |   11 ++++---
 tests/tap/basic.h            |    2 +
 tests/tap/float.c            |    2 +
 tests/tap/float.h            |    2 +
 tests/tap/libtap.sh          |    2 +
 tests/tap/macros.h           |    2 +
 14 files changed, 88 insertions(+), 54 deletions(-)

Modified: include/clibrary.h
===================================================================
--- include/clibrary.h	2018-01-07 14:43:33 UTC (rev 10220)
+++ include/clibrary.h	2018-01-23 20:35:52 UTC (rev 10221)
@@ -174,7 +174,8 @@
 #if !HAVE_ASPRINTF
 extern int asprintf(char **, const char *, ...)
     __attribute__((__format__(printf, 2, 3)));
-extern int vasprintf(char **, const char *, va_list);
+extern int vasprintf(char **, const char *, va_list)
+    __attribute__((__format__(printf, 2, 0)));
 #endif
 #if !HAVE_DECL_SNPRINTF
 extern int snprintf(char *, size_t, const char *, ...)
@@ -181,7 +182,8 @@
     __attribute__((__format__(printf, 3, 4)));
 #endif
 #if !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
+extern int vsnprintf(char *, size_t, const char *, va_list)
+    __attribute__((__format__(printf, 3, 0)));
 #endif
 #if !HAVE_MKSTEMP
 extern int mkstemp(char *);

Modified: support/getc-tap-harness
===================================================================
--- support/getc-tap-harness	2018-01-07 14:43:33 UTC (rev 10220)
+++ support/getc-tap-harness	2018-01-23 20:35:52 UTC (rev 10221)
@@ -73,7 +73,7 @@
     # Specific additions to a few files.
     if [ "$3" = "basic.c" ]
     then
-      sed -i -e "56 i \\
+      sed -i -e "58 i \\
 /* Specific to the integration of C TAP Harness in INN. */\\
 #ifndef LIBTEST_NEW_FORMAT\\
 # include \"inn/libinn.h\"\\
@@ -133,9 +133,9 @@
 }\\
 #endif\\
 " \
-             -e "151 i \\
+             -e "152 i \\
 #ifndef INN_LIBINN_H" \
-             -e "185 i \\
+             -e "186 i \\
 #endif" \
              -e 's/^ok.int /new_ok(int /g' \
              -e 's/^skip.const /new_skip(const /g' \
@@ -146,7 +146,7 @@
 
     if [ "$3" = "basic.h" ]
     then
-      sed -i -e "75 i \\
+      sed -i -e "77 i \\
 #ifndef LIBTEST_NEW_FORMAT\\
 /* Specific to the integration of C TAP Harness in INN. */\\
 void ok(int n, int success);\\
@@ -172,7 +172,7 @@
 # define skip new_skip\\
 # define ok_block new_ok_block\\
 # define skip_block new_skip_block" \
-             -e "90 i \\
+             -e "92 i \\
 #endif" \
              ${TEMP}
     fi
@@ -179,7 +179,7 @@
 
     if [ "$3" = "float.c" ]
     then
-      sed -i -e "50 i \\
+      sed -i -e "52 i \\
 #ifndef LIBTEST_NEW_FORMAT\\
 /* Specific to the integration of C TAP Harness in INN. */\\
 void\\
@@ -194,7 +194,7 @@
 
     if [ "$3" = "float.h" ]
     then
-      sed -i -e "37 i \\
+      sed -i -e "39 i \\
 #ifndef LIBTEST_NEW_FORMAT\\
 /* Specific to the integration of C TAP Harness in INN. */\\
 void ok_double(int n, double wanted, double seen);\\

Modified: support/getrra-c-util
===================================================================
--- support/getrra-c-util	2018-01-07 14:43:33 UTC (rev 10220)
+++ support/getrra-c-util	2018-01-23 20:35:52 UTC (rev 10221)
@@ -161,7 +161,7 @@
 extern int symlink(const char *, const char *);\\
 #endif\\
 " \
-               -e "154 i \\
+               -e "156 i \\
 #if !HAVE_DECL_STRLCAT\\
 extern size_t strlcat(char *, const char *, size_t);\\
 #endif\\

Modified: tests/README
===================================================================
--- tests/README	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/README	2018-01-23 20:35:52 UTC (rev 10221)
@@ -248,3 +248,5 @@
     are permitted in any medium without royalty provided the copyright
     notice and this notice are preserved.  This file is offered as-is,
     without any warranty.
+
+    SPDX-License-Identifier: FSFAP

Modified: tests/docs/pod.t
===================================================================
--- tests/docs/pod.t	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/docs/pod.t	2018-01-23 20:35:52 UTC (rev 10221)
@@ -7,7 +7,7 @@
 # This file is part of C TAP Harness.  The current version plus supporting
 # documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
 #
-# Copyright 2009, 2010, 2013, 2014, 2015, 2016 Russ Allbery <eagle at eyrie.org>
+# Copyright 2009-2010, 2013-2016 Russ Allbery <eagle at eyrie.org>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,6 +26,8 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
 
 use 5.006;
 use strict;

Modified: tests/lib/asprintf-t.c
===================================================================
--- tests/lib/asprintf-t.c	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/lib/asprintf-t.c	2018-01-23 20:35:52 UTC (rev 10221)
@@ -26,9 +26,10 @@
 
 int test_asprintf(char **, const char *, ...)
     __attribute__((__format__(printf, 2, 3)));
-int test_vasprintf(char **, const char *, va_list);
+int test_vasprintf(char **, const char *, va_list)
+    __attribute__((__format__(printf, 2, 0)));
 
-static int
+static int __attribute__((__format__(printf, 2, 3)))
 vatest(char **result, const char *format, ...)
 {
     va_list args;

Modified: tests/lib/network/server-t.c
===================================================================
--- tests/lib/network/server-t.c	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/lib/network/server-t.c	2018-01-23 20:35:52 UTC (rev 10221)
@@ -6,8 +6,8 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2016, 2017 Russ Allbery <eagle at eyrie.org>
- * Copyright 2009, 2010, 2011, 2012, 2013
+ * Copyright 2005, 2013, 2016-2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2009-2013
  *     The Board of Trustees of the Leland Stanford Junior University
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -237,9 +237,14 @@
  * A varient version of the server portion of the test.  Takes an array of
  * sockets and the size of the sockets and accepts a connection on any of
  * those sockets.  Ensures that the client address information is stored
- * correctly by checking that it is set to IPv4 localhost.  For skipping
- * purposes, this produces four tests.
+ * correctly by checking that it is an IPv4 address.  For skipping purposes,
+ * this produces three tests.
  *
+ * Normally, the client address should be 127.0.0.1, but hosts with odd local
+ * networking setups may rewrite client IP addresses so that they appear to
+ * come from other addresses.  Avoid checking if the client IP is 127.0.0.1
+ * for that reason.  Hopefully this won't hide bugs.
+ *
  * saddr is allocated from the heap instead of using a local struct
  * sockaddr_storage to work around a misdiagnosis of strict aliasing
  * violations from gcc 4.4 (fixed in later versions).
@@ -261,9 +266,6 @@
     client = network_accept_any(fds, count, saddr, &slen);
     test_server_connection(client);
     is_int(AF_INET, saddr->sa_family, "...address family is IPv4");
-    is_int(htonl(0x7f000001UL),
-           ((struct sockaddr_in *) (void *) saddr)->sin_addr.s_addr,
-           "...and client address is 127.0.0.1");
     free(saddr);
     for (i = 0; i < count; i++)
         socket_close(fds[i]);
@@ -526,9 +528,17 @@
         is_int(13, length, "...of correct length");
         sin.sin_family = AF_INET;
         sin.sin_port = htons(11119);
-        sin.sin_addr.s_addr = htonl(0x7f000001UL);
+
+        /*
+         * We'd prefer to check that the client IP address is 127.0.0.1 here,
+         * but hosts with odd local networking setups may rewrite the client
+         * IP address to something else.  To avoid false positives, just
+         * blindly trust the client IP address is correct, since it seems
+         * unlikely we'll have a server code bug here.
+         */
+        sin.sin_addr = ((struct sockaddr_in *) &addr)->sin_addr;
         ok(network_sockaddr_equal((struct sockaddr *) &sin, saddr),
-           "...from correct address");
+           "...from correct family and port");
         buffer[13] = '\0';
         is_string("socket test\r\n", buffer, "...and correct contents");
     }
@@ -548,7 +558,7 @@
 main(void)
 {
     /* Set up the plan. */
-    plan(43);
+    plan(42);
 
     /* Test network_bind functions. */
     test_ipv4(NULL);

Modified: tests/runtests.c
===================================================================
--- tests/runtests.c	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/runtests.c	2018-01-23 20:35:52 UTC (rev 10221)
@@ -2,6 +2,37 @@
  *
  * Run a set of tests, reporting results.
  *
+ * Test suite driver that runs a set of tests implementing a subset of the
+ * Test Anything Protocol (TAP) and reports the results.
+ *
+ * Any bug reports, bug fixes, and improvements are very much welcome and
+ * should be sent to the e-mail address below.  This program is part of C TAP
+ * Harness <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
+ *
+ * Copyright 2000-2001, 2004, 2006-2018 Russ Allbery <eagle at eyrie.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/*
  * Usage:
  *
  *      runtests [-hv] [-b <build-dir>] [-s <source-dir>] -l <test-list>
@@ -58,32 +89,7 @@
  * If the -v option is given, or the C_TAP_VERBOSE environment variable is set,
  * display the full output of each test as it runs rather than showing a
  * summary of the results of each test.
- *
- * Any bug reports, bug fixes, and improvements are very much welcome and
- * should be sent to the e-mail address below.  This program is part of C TAP
- * Harness <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
- *
- * Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
- *     2014, 2015, 2016, 2017 Russ Allbery <eagle at eyrie.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
-*/
+ */
 
 /* Required for fdopen(), getopt(), and putenv(). */
 #if defined(__STRICT_ANSI__) || defined(PEDANTIC)

Modified: tests/tap/basic.c
===================================================================
--- tests/tap/basic.c	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/tap/basic.c	2018-01-23 20:35:52 UTC (rev 10221)
@@ -13,9 +13,9 @@
  * This file is part of C TAP Harness.  The current version plus supporting
  * documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
  *
- * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
- *     Russ Allbery <eagle at eyrie.org>
- * Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013, 2014
+ * Written by Russ Allbery <eagle at eyrie.org>
+ * Copyright 2009-2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2001-2002, 2004-2008, 2011-2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +35,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #include <errno.h>
@@ -188,8 +190,7 @@
     do {                                        \
         if (format != NULL) {                   \
             va_list args;                       \
-            if (prefix != NULL)                 \
-                printf("%s", prefix);           \
+            printf("%s", prefix);               \
             va_start(args, format);             \
             vprintf(format, args);              \
             va_end(args);                       \

Modified: tests/tap/basic.h
===================================================================
--- tests/tap/basic.h	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/tap/basic.h	2018-01-23 20:35:52 UTC (rev 10221)
@@ -27,6 +27,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #ifndef TAP_BASIC_H

Modified: tests/tap/float.c
===================================================================
--- tests/tap/float.c	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/tap/float.c	2018-01-23 20:35:52 UTC (rev 10221)
@@ -31,6 +31,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 /* Required for isnan() and isinf(). */

Modified: tests/tap/float.h
===================================================================
--- tests/tap/float.h	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/tap/float.h	2018-01-23 20:35:52 UTC (rev 10221)
@@ -24,6 +24,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #ifndef TAP_FLOAT_H

Modified: tests/tap/libtap.sh
===================================================================
--- tests/tap/libtap.sh	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/tap/libtap.sh	2018-01-23 20:35:52 UTC (rev 10221)
@@ -33,6 +33,8 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
 
 # Print out the number of test cases we expect to run.
 plan () {

Modified: tests/tap/macros.h
===================================================================
--- tests/tap/macros.h	2018-01-07 14:43:33 UTC (rev 10220)
+++ tests/tap/macros.h	2018-01-23 20:35:52 UTC (rev 10221)
@@ -28,6 +28,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #ifndef TAP_MACROS_H



More information about the inn-committers mailing list