Send inn-committers mailing list submissions to inn-committers@lists.isc.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.isc.org/mailman/listinfo/inn-committers or, via email, send a message with subject or body 'help' to inn-committers-requ...@lists.isc.org You can reach the person managing the list at inn-committers-ow...@lists.isc.org When replying, please edit your Subject line so it is more specific than "Re: Contents of inn-committers digest..." Today's Topics: 1. INN commit: trunk (6 files) (INN Commit) 2. INN commit: trunk/tests/lib (getaddrinfo-t.c) (INN Commit) 3. INN commit: trunk (12 files) (INN Commit) ---------------------------------------------------------------------- Message: 1 Date: Thu, 4 Sep 2014 12:34:06 -0700 (PDT) From: INN Commit <r...@isc.org> To: inn-committ...@isc.org Subject: INN commit: trunk (6 files) Message-ID: <20140904193406.9ef4e67...@hope.eyrie.org> Date: Thursday, September 4, 2014 @ 12:34:06 Author: iulius Revision: 9673 sync the vector test suite with upstream version Add new string utilities for the TAP protocol. Update the vector test suite with latest rra-c-util version. Added: trunk/tests/tap/string.c trunk/tests/tap/string.h Modified: trunk/MANIFEST trunk/include/inn/vector.h trunk/tests/Makefile trunk/tests/lib/vector-t.c ----------------------+ MANIFEST | 2 include/inn/vector.h | 2 tests/Makefile | 4 - tests/lib/vector-t.c | 103 +++++++++++++++++++++++++++++++++++++++---------- tests/tap/string.c | 66 +++++++++++++++++++++++++++++++ tests/tap/string.h | 50 +++++++++++++++++++++++ 6 files changed, 203 insertions(+), 24 deletions(-) Modified: MANIFEST =================================================================== --- MANIFEST 2014-09-03 17:54:25 UTC (rev 9672) +++ MANIFEST 2014-09-04 19:34:06 UTC (rev 9673) @@ -920,6 +920,8 @@ tests/tap/float.h Header file for floating point routines tests/tap/libtap.sh Helper shell library for writing tests tests/tap/macros.h Helpful macros for TAP header files +tests/tap/string.c String utilities for the TAP protocol +tests/tap/string.h Header file for string utilities tests/util Test suite for utilities (Directory) tests/util/convdate.t Tests for expire/convdate tests/util/innbind-t.c Tests for backends/innbind Modified: include/inn/vector.h =================================================================== --- include/inn/vector.h 2014-09-03 17:54:25 UTC (rev 9672) +++ include/inn/vector.h 2014-09-04 19:34:06 UTC (rev 9673) @@ -26,7 +26,7 @@ #ifndef INN_VECTOR_H #define INN_VECTOR_H 1 -#include <inn/defines.h> +#include "config.h" #include <stddef.h> Modified: tests/Makefile =================================================================== --- tests/Makefile 2014-09-03 17:54:25 UTC (rev 9672) +++ tests/Makefile 2014-09-04 19:34:06 UTC (rev 9673) @@ -223,8 +223,8 @@ lib/uwildmat.t: lib/uwildmat-t.o tap/basic.o $(LIBINN) $(LINK) lib/uwildmat-t.o tap/basic.o $(LIBINN) -lib/vector.t: lib/vector-t.o tap/basic.o $(LIBINN) - $(LINK) lib/vector-t.o tap/basic.o $(LIBINN) +lib/vector.t: lib/vector-t.o tap/basic.o tap/string.o $(LIBINN) + $(LINK) lib/vector-t.o tap/basic.o tap/string.o $(LIBINN) lib/wire.t: lib/wire-t.o tap/basic.o $(LIBINN) $(LINK) lib/wire-t.o tap/basic.o $(LIBINN) Modified: tests/lib/vector-t.c =================================================================== --- tests/lib/vector-t.c 2014-09-03 17:54:25 UTC (rev 9672) +++ tests/lib/vector-t.c 2014-09-04 19:34:06 UTC (rev 9673) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * vector test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -21,32 +20,41 @@ #include "config.h" #include "clibrary.h" + #include "portable/wait.h" -#include "inn/messages.h" +#include "tap/basic.h" +#include "tap/string.h" #include "inn/vector.h" #include "inn/libinn.h" -#include "tap/basic.h" + int main(void) { struct vector *vector; struct cvector *cvector; - const char cstring[] = "This is a\ttest. "; - const char tabs[] = "test\t\ting\t"; + char *command, *string; + char *p; + pid_t child; + char empty[] = ""; + static const char cstring[] = "This is a\ttest. "; static const char nulls1[] = "This\0is\0a\0test."; static const char nulls2[] = "This is a\t\0es\0. "; - char empty[] = ""; - char buffer[256]; - char *string; - char *p; - pid_t child; + static const char tabs[] = "test\t\ting\t"; - plan(117); + /* Set up the plan. */ + plan(119); + /* Be sure that freeing NULL doesn't cause a NULL pointer dereference. */ + vector_free(NULL); + cvector_free(NULL); + + /* Test basic add and resize functionality for vectors. */ vector = vector_new(); ok(vector != NULL, "vector_new returns non-NULL"); + if (vector == NULL) + bail("vector_new returned NULL"); vector_add(vector, cstring); is_int(1, vector->count, "vector_add increases count"); ok(vector->strings[0] != cstring, "...and allocated new memory"); @@ -61,13 +69,19 @@ is_string(cstring, vector->strings[1], "added the right string"); is_string(cstring, vector->strings[2], "added the right string"); is_string(cstring, vector->strings[3], "added the right string"); + + /* Verify that adding the same string creates new copies. */ ok(vector->strings[1] != vector->strings[2], "each pointer is different"); ok(vector->strings[2] != vector->strings[3], "each pointer is different"); ok(vector->strings[3] != vector->strings[0], "each pointer is different"); ok(vector->strings[0] != cstring, "each pointer is different"); + + /* Test vector_clear. */ vector_clear(vector); is_int(0, vector->count, "vector_clear works"); is_int(4, vector->allocated, "...but doesn't free the allocation"); + + /* Test that resizing the vector shrinks it and frees the string. */ string = xstrdup(cstring); vector_add(vector, cstring); vector_add(vector, string); @@ -76,14 +90,19 @@ vector_resize(vector, 1); is_int(1, vector->count, "vector_resize shrinks the vector"); ok(vector->strings[0] != cstring, "...and the pointer is different"); + free(string); + + /* Test vector_addn. */ vector_addn(vector, cstring, 4); is_int(2, vector->count, "vector_addn increments count"); is_string("This", vector->strings[1], "...and adds the right data"); vector_free(vector); - free(string); + /* Test basic add and resize functionality for cvectors. */ cvector = cvector_new(); ok(cvector != NULL, "cvector_new returns non-NULL"); + if (cvector == NULL) + bail("cvector_new returned NULL"); cvector_add(cvector, cstring); is_int(1, cvector->count, "cvector_add adds a string"); ok(cvector->strings[0] == cstring, "...and keeps the same pointer"); @@ -98,9 +117,13 @@ ok(cvector->strings[2] == cvector->strings[3], "all pointers match"); ok(cvector->strings[3] == cvector->strings[0], "all pointers match"); ok(cvector->strings[0] == cstring, "all pointers match"); + + /* Test cvector_clear. */ cvector_clear(cvector); is_int(0, cvector->count, "cvector_clear works"); is_int(4, cvector->allocated, "...but doesn't free the allocation"); + + /* Test that resizing the vector shrinks it. */ string = xstrdup(cstring); cvector_add(cvector, cstring); cvector_add(cvector, string); @@ -112,6 +135,7 @@ cvector_free(cvector); free(string); + /* Test vector_split_space. */ vector = vector_split_space("This is a\ttest. ", NULL); is_int(4, vector->count, "vector_split_space returns right count"); is_int(4, vector->allocated, "...and allocation"); @@ -119,10 +143,14 @@ is_string("is", vector->strings[1], "...second string"); is_string("a", vector->strings[2], "...third string"); is_string("test.", vector->strings[3], "...fourth string"); + + /* Test that vector_add increases the size of the vector by one. */ vector_add(vector, cstring); is_string(cstring, vector->strings[4], "...and can add another"); ok(vector->strings[4] != cstring, "allocates a new pointer"); is_int(5, vector->allocated, "allocation goes up by one"); + + /* Test vector_split with vector reuse. */ vector = vector_split(cstring, 't', vector); is_int(3, vector->count, "resplitting returns the right count"); is_int(5, vector->allocated, "...but doesn't change allocation"); @@ -130,11 +158,14 @@ is_string("es", vector->strings[1], "...second string"); is_string(". ", vector->strings[2], "...third string"); ok(vector->strings[0] != cstring, "...and allocated new string"); + + /* Test vector_join. */ p = vector_join(vector, "fe"); is_string("This is a\tfeesfe. ", p, "vector_join works"); free(p); vector_free(vector); + /* Test cvector_split_space. */ string = xstrdup(cstring); cvector = cvector_split_space(string, NULL); is_int(4, cvector->count, "cvector_split_space returns right count"); @@ -144,10 +175,14 @@ is_string("a", cvector->strings[2], "...third string"); is_string("test.", cvector->strings[3], "...fourth string"); ok(memcmp(string, nulls1, 16) == 0, "original string modified in place"); + + /* Test that cvector_add increases the size of the vector by one. */ cvector_add(cvector, cstring); ok(cvector->strings[4] == cstring, "cvector_add then works"); is_int(5, cvector->allocated, "...and allocation increases by one"); free(string); + + /* Test cvector_split with vector reuse. */ string = xstrdup(cstring); cvector = cvector_split(string, 't', cvector); is_int(3, cvector->count, "cvector_split into same cvector works"); @@ -157,12 +192,15 @@ is_string(". ", cvector->strings[2], "...third string"); ok(cvector->strings[0] == string, "no new memory is allocated"); ok(memcmp(string, nulls2, 18) == 0, "...and string is modified in place"); + + /* Test cvector_join. */ p = cvector_join(cvector, "oo"); is_string("This is a\tooesoo. ", p, "cvector_join works"); free(p); cvector_free(cvector); free(string); + /* Test vector_split and cvector_split on empty string. */ vector = vector_split("", ' ', NULL); is_int(1, vector->count, "vector_split on empty string"); is_string("", vector->strings[0], "...returns only empty string"); @@ -172,13 +210,21 @@ is_string("", cvector->strings[0], "...returns only empty string"); cvector_free(cvector); + /* Test vector_split_space and cvector_split_space on empty string. */ vector = vector_split_space("", NULL); is_int(0, vector->count, "vector_split_space on empty string"); + p = vector_join(vector, "mumble"); + is_string("", p, "vector_join with an empty vector works"); + free(p); vector_free(vector); cvector = cvector_split_space(empty, NULL); is_int(0, cvector->count, "cvector_split_space on empty string"); + p = cvector_join(cvector, "mumble"); + is_string("", p, "cvector_join with an empty vector works"); + free(p); cvector_free(cvector); + /* Test vector_split again and then join with an empty string. */ vector = vector_split(tabs, '\t', NULL); is_int(4, vector->count, "vector_split on tab string"); is_string("test", vector->strings[0], "...first string"); @@ -190,6 +236,7 @@ free(p); vector_free(vector); + /* Test cvector_split again and then join with an empty string. */ string = xstrdup(tabs); cvector = cvector_split(string, '\t', NULL); is_int(4, cvector->count, "cvector_split on tab string"); @@ -203,11 +250,11 @@ cvector_free(cvector); free(string); + /* Test that newline is not space for (c)vector_split_space. */ vector = vector_split_space("foo\nbar", NULL); is_int(1, vector->count, "newline is not space for vector_split_space"); is_string("foo\nbar", vector->strings[0], "...first string"); vector_free(vector); - string = xstrdup("foo\nbar"); cvector = cvector_split_space(string, NULL); is_int(1, cvector->count, "newline is not space for cvector_split_space"); @@ -215,11 +262,11 @@ cvector_free(cvector); free(string); + /* Test (c)vector_split_space with leading and trailing delimiters. */ vector = vector_split_space(" \t foo\t", NULL); is_int(1, vector->count, "extra whitespace in vector_split_space"); is_string("foo", vector->strings[0], "...first string"); vector_free(vector); - string = xstrdup(" \t foo\t"); cvector = cvector_split_space(string, NULL); is_int(1, cvector->count, "extra whitespace in cvector_split_space"); @@ -227,6 +274,7 @@ cvector_free(cvector); free(string); + /* Test (c)vector_split_space on a string that's all delimiters. */ vector = vector_split_space(" \t ", NULL); is_int(0, vector->count, "vector_split_space on all whitespace string"); vector_free(vector); @@ -234,12 +282,15 @@ cvector = cvector_split_space(string, NULL); is_int(0, cvector->count, "cvector_split_space on all whitespace string"); cvector_free(cvector); + free(string); + /* Test vector_split_multi. */ vector = vector_split_multi("foo, bar, baz", ", ", NULL); is_int(3, vector->count, "vector_split_multi returns right count"); is_string("foo", vector->strings[0], "...first string"); is_string("bar", vector->strings[1], "...second string"); is_string("baz", vector->strings[2], "...third string"); + vector_free(vector); vector = vector_split_multi("", ", ", NULL); is_int(0, vector->count, "vector_split_multi reuse with empty string"); vector = vector_split_multi(",,, foo, ", ", ", vector); @@ -249,6 +300,7 @@ is_int(0, vector->count, "vector_split_multi with only separators"); vector_free(vector); + /* Test cvector_split_multi. */ string = xstrdup("foo, bar, baz"); cvector = cvector_split_multi(string, ", ", NULL); is_int(3, cvector->count, "cvector_split_multi returns right count"); @@ -256,6 +308,7 @@ is_string("bar", cvector->strings[1], "...second string"); is_string("baz", cvector->strings[2], "...third string"); free(string); + cvector_free(cvector); cvector = cvector_split_multi(empty, ", ", NULL); is_int(0, cvector->count, "cvector_split_multi reuse with empty string"); string = xstrdup(",,, foo, "); @@ -269,11 +322,15 @@ cvector_free(cvector); free(string); + /* + * Test vector_exec. We mess with testnum here since the child outputs + * the okay message. + */ vector = vector_new(); vector_add(vector, "/bin/sh"); vector_add(vector, "-c"); - snprintf(buffer, sizeof(buffer), "echo ok %lu - vector_exec", testnum++); - vector_add(vector, buffer); + basprintf(&command, "echo ok %lu - vector_exec", testnum++); + vector_add(vector, command); child = fork(); if (child < 0) sysbail("unable to fork"); @@ -282,12 +339,14 @@ sysdiag("unable to exec /bin/sh"); waitpid(child, NULL, 0); vector_free(vector); + free(command); + /* Test cvector_exec the same way. */ cvector = cvector_new(); cvector_add(cvector, "/bin/sh"); cvector_add(cvector, "-c"); - snprintf(buffer, sizeof(buffer), "echo ok %lu - cvector_exec", testnum++); - cvector_add(cvector, buffer); + basprintf(&command, "echo ok %lu - cvector_exec", testnum++); + cvector_add(cvector, command); child = fork(); if (child < 0) sysbail("unable to fork"); @@ -296,6 +355,8 @@ sysdiag("unable to exec /bin/sh"); waitpid(child, NULL, 0); cvector_free(cvector); + free(command); + /* All done. */ return 0; } Added: tests/tap/string.c =================================================================== --- tests/tap/string.c (rev 0) +++ tests/tap/string.c 2014-09-04 19:34:06 UTC (rev 9673) @@ -0,0 +1,66 @@ +/* $Id$ + * + * String utilities for the TAP protocol. + * + * Additional string utilities that can't be included with C TAP Harness + * because they rely on additional portability code from rra-c-util. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Copyright 2011, 2012 Russ Allbery <ea...@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. + */ + +#include "config.h" +#include "clibrary.h" + +#include "tap/basic.h" +#include "tap/string.h" + + +/* + * vsprintf into a newly allocated string, reporting a fatal error with bail + * on failure. + */ +void +bvasprintf(char **strp, const char *fmt, va_list args) +{ + int status; + + status = vasprintf(strp, fmt, args); + if (status < 0) + sysbail("failed to allocate memory for vasprintf"); +} + + +/* + * sprintf into a newly allocated string, reporting a fatal error with bail on + * failure. + */ +void +basprintf(char **strp, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + bvasprintf(strp, fmt, args); + va_end(args); +} Property changes on: trunk/tests/tap/string.c ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: tests/tap/string.h =================================================================== --- tests/tap/string.h (rev 0) +++ tests/tap/string.h 2014-09-04 19:34:06 UTC (rev 9673) @@ -0,0 +1,50 @@ +/* $Id$ + * + * String utilities for the TAP protocol. + * + * Additional string utilities that can't be included with C TAP Harness + * because they rely on additional portability code from rra-c-util. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Copyright 2011, 2012 Russ Allbery <ea...@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. + */ + +#ifndef TAP_STRING_H +#define TAP_STRING_H 1 + +#include "config.h" +#include "tap/macros.h" + +#include <stdarg.h> /* va_list */ + +BEGIN_DECLS + +/* sprintf into an allocated string, calling bail on any failure. */ +void basprintf(char **, const char *, ...) + __attribute__((__nonnull__, __format__(printf, 2, 3))); +void bvasprintf(char **, const char *, va_list) + __attribute__((__nonnull__)); + +END_DECLS + +#endif /* !TAP_STRING_H */ Property changes on: trunk/tests/tap/string.h ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision ------------------------------ Message: 2 Date: Thu, 4 Sep 2014 12:39:20 -0700 (PDT) From: INN Commit <r...@isc.org> To: inn-committ...@isc.org Subject: INN commit: trunk/tests/lib (getaddrinfo-t.c) Message-ID: <20140904193920.159de67...@hope.eyrie.org> Date: Thursday, September 4, 2014 @ 12:39:19 Author: iulius Revision: 9674 sync the getaddrinfo test suite with upstream version Changes are: - Close memory and file descriptor leaks in the test suite. - In some situations, DNS may just not work, in which case we may get different error messages than host not found when looking up invalid hosts. Allow for that and skip the test in those situations. - Also change a few network tests to use is_int for comparing IPv4 addresses rather than ok with equality. Modified: trunk/tests/lib/getaddrinfo-t.c -----------------+ getaddrinfo-t.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) Modified: getaddrinfo-t.c =================================================================== --- getaddrinfo-t.c 2014-09-04 19:34:06 UTC (rev 9673) +++ getaddrinfo-t.c 2014-09-04 19:39:19 UTC (rev 9674) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * getaddrinfo test suite. - * - * $Id$ * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -23,7 +22,6 @@ #include "clibrary.h" #include "portable/socket.h" -#include "inn/messages.h" #include "tap/basic.h" /* @@ -73,7 +71,7 @@ is_int(sizeof(struct sockaddr_in), ai->ai_addrlen, "...right addrlen"); saddr = (struct sockaddr_in *) (void *) ai->ai_addr; is_int(htons(25), saddr->sin_port, "...right port"); - ok(saddr->sin_addr.s_addr == htonl(0x7f000001UL), "...right address"); + is_int(htonl(0x7f000001UL), saddr->sin_addr.s_addr, "...right address"); test_freeaddrinfo(ai); memset(&hints, 0, sizeof(hints)); @@ -83,7 +81,7 @@ is_int(SOCK_STREAM, ai->ai_socktype, "...right socktype"); saddr = (struct sockaddr_in *) (void *) ai->ai_addr; is_int(htons(25), saddr->sin_port, "...right port"); - ok(saddr->sin_addr.s_addr == INADDR_ANY, "...right address"); + is_int(INADDR_ANY, saddr->sin_addr.s_addr, "...right address"); test_freeaddrinfo(ai); service = getservbyname("smtp", "tcp"); @@ -96,7 +94,7 @@ is_int(SOCK_STREAM, ai->ai_socktype, "...right socktype"); saddr = (struct sockaddr_in *) (void *) ai->ai_addr; is_int(htons(25), saddr->sin_port, "...right port"); - ok(saddr->sin_addr.s_addr == INADDR_ANY, "...right address"); + is_int(INADDR_ANY, saddr->sin_addr.s_addr, "...right address"); test_freeaddrinfo(ai); } @@ -111,7 +109,7 @@ "valid AI_NUMERICSERV"); saddr = (struct sockaddr_in *) (void *) ai->ai_addr; is_int(htons(25), saddr->sin_port, "...right port"); - ok(saddr->sin_addr.s_addr == htonl(0x7f000001UL), "...right address"); + is_int(htonl(0x7f000001UL), saddr->sin_addr.s_addr, "...right address"); test_freeaddrinfo(ai); ok(test_getaddrinfo(NULL, NULL, NULL, &ai) == EAI_NONAME, "EAI_NONAME"); @@ -228,6 +226,7 @@ if (host == NULL) skip_block(3, "cannot look up cnn.com"); else { + ai = NULL; ok(test_getaddrinfo("cnn.com", "80", NULL, &ai) == 0, "lookup of cnn.com with multiple A records"); saddr = (struct sockaddr_in *) (void *) ai->ai_addr; @@ -240,8 +239,14 @@ if (host != NULL) skip("lookup of addrinfo-test.invalid succeeded"); else { + ai = NULL; result = test_getaddrinfo("addrinfo-test.invalid", NULL, NULL, &ai); - is_int(EAI_NONAME, result, "lookup of invalid address"); + if (result == EAI_AGAIN || result == EAI_FAIL) + skip("lookup of invalid address returns DNS failure"); + else + is_int(EAI_NONAME, result, "lookup of invalid address"); + if (ai != NULL) + test_freeaddrinfo(ai); } host = gethostbyname("cnn.com"); @@ -278,7 +283,7 @@ } if (found) ok(1, "...result found in gethostbyname address list"); - test_freeaddrinfo(ai); + test_freeaddrinfo(first); return 0; } ------------------------------ Message: 3 Date: Thu, 4 Sep 2014 12:45:26 -0700 (PDT) From: INN Commit <r...@isc.org> To: inn-committ...@isc.org Subject: INN commit: trunk (12 files) Message-ID: <20140904194526.b8dac67...@hope.eyrie.org> Date: Thursday, September 4, 2014 @ 12:45:26 Author: iulius Revision: 9675 sync a few tests and headers with upstream Better header inclusions, especially portable/socket.h instead of standard netinet/in.h for inet_aton and inet_ntoa tests. Also deactivate the Wformat-nonliteral warning for the snprintf test suite. Modified: trunk/include/inn/buffer.h trunk/include/inn/fdflag.h trunk/tests/lib/asprintf-t.c trunk/tests/lib/getnameinfo-t.c trunk/tests/lib/inet_aton-t.c trunk/tests/lib/inet_ntoa-t.c trunk/tests/lib/inet_ntop-t.c trunk/tests/lib/mkstemp-t.c trunk/tests/lib/setenv-t.c trunk/tests/lib/snprintf-t.c trunk/tests/lib/strlcat-t.c trunk/tests/lib/strlcpy-t.c ---------------------------+ include/inn/buffer.h | 3 ++- include/inn/fdflag.h | 2 +- tests/lib/asprintf-t.c | 7 +++---- tests/lib/getnameinfo-t.c | 10 ++++------ tests/lib/inet_aton-t.c | 9 ++++----- tests/lib/inet_ntoa-t.c | 9 ++++----- tests/lib/inet_ntop-t.c | 8 ++++---- tests/lib/mkstemp-t.c | 8 ++++---- tests/lib/setenv-t.c | 10 ++++------ tests/lib/snprintf-t.c | 11 +++++------ tests/lib/strlcat-t.c | 7 +++---- tests/lib/strlcpy-t.c | 7 +++---- 12 files changed, 41 insertions(+), 50 deletions(-) Modified: include/inn/buffer.h =================================================================== --- include/inn/buffer.h 2014-09-04 19:39:19 UTC (rev 9674) +++ include/inn/buffer.h 2014-09-04 19:45:26 UTC (rev 9675) @@ -44,9 +44,10 @@ #ifndef INN_BUFFER_H #define INN_BUFFER_H 1 +#include "config.h" + #include <stdarg.h> #include <sys/types.h> -#include <inn/defines.h> struct buffer { size_t size; /* Total allocated length. */ Modified: include/inn/fdflag.h =================================================================== --- include/inn/fdflag.h 2014-09-04 19:39:19 UTC (rev 9674) +++ include/inn/fdflag.h 2014-09-04 19:45:26 UTC (rev 9675) @@ -31,7 +31,7 @@ #ifndef INN_FDFLAG_H #define INN_FDFLAG_H 1 -#include <inn/defines.h> +#include "config.h" #include "portable/socket.h" BEGIN_DECLS Modified: tests/lib/asprintf-t.c =================================================================== --- tests/lib/asprintf-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/asprintf-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * asprintf and vasprintf test suite. - * - * $Id$ * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or Modified: tests/lib/getnameinfo-t.c =================================================================== --- tests/lib/getnameinfo-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/getnameinfo-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * getnameinfo test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -23,9 +22,8 @@ #include "clibrary.h" #include "portable/socket.h" -#include "inn/messages.h" -#include "inn/libinn.h" #include "tap/basic.h" +#include "inn/libinn.h" int test_getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int); Modified: tests/lib/inet_aton-t.c =================================================================== --- tests/lib/inet_aton-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/inet_aton-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * inet_aton test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -21,7 +20,7 @@ #include "config.h" #include "clibrary.h" -#include <netinet/in.h> +#include "portable/socket.h" #include "tap/basic.h" Modified: tests/lib/inet_ntoa-t.c =================================================================== --- tests/lib/inet_ntoa-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/inet_ntoa-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * inet_ntoa test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -21,7 +20,7 @@ #include "config.h" #include "clibrary.h" -#include <netinet/in.h> +#include "portable/socket.h" #include "tap/basic.h" Modified: tests/lib/inet_ntop-t.c =================================================================== --- tests/lib/inet_ntop-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/inet_ntop-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * inet_ntop test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -22,6 +21,7 @@ #include "config.h" #include "clibrary.h" #include "portable/socket.h" + #include <errno.h> #include "tap/basic.h" Modified: tests/lib/mkstemp-t.c =================================================================== --- tests/lib/mkstemp-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/mkstemp-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * mkstemp test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -21,6 +20,7 @@ #include "config.h" #include "clibrary.h" + #include <errno.h> #include <sys/stat.h> Modified: tests/lib/setenv-t.c =================================================================== --- tests/lib/setenv-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/setenv-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * setenv test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or @@ -21,10 +20,9 @@ #include "config.h" #include "clibrary.h" + #include <errno.h> -#include "inn/messages.h" -#include "inn/libinn.h" #include "tap/basic.h" int test_setenv(const char *name, const char *value, int overwrite); Modified: tests/lib/snprintf-t.c =================================================================== --- tests/lib/snprintf-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/snprintf-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,14 +1,13 @@ -/* +/* $Id$ + * * snprintf test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 - * Russ Allbery <r...@stanford.edu> + * Russ Allbery <ea...@eyrie.org> * Copyright 2009, 2010 * The Board of Trustees of the Leland Stanford Junior University * Copyright 1995 Patrick Powell @@ -30,7 +29,7 @@ * Disable the requirement that format strings be literals. We need variable * formats for easy testing. */ -//#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#pragma GCC diagnostic ignored "-Wformat-nonliteral" /* * Intentionally don't add the printf attribute here since we pass a Modified: tests/lib/strlcat-t.c =================================================================== --- tests/lib/strlcat-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/strlcat-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * strlcat test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or Modified: tests/lib/strlcpy-t.c =================================================================== --- tests/lib/strlcpy-t.c 2014-09-04 19:39:19 UTC (rev 9674) +++ tests/lib/strlcpy-t.c 2014-09-04 19:45:26 UTC (rev 9675) @@ -1,12 +1,11 @@ -/* +/* $Id$ + * * strlcpy test suite. * - * $Id$ - * * The canonical version of this file is maintained in the rra-c-util package, * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. * - * Written by Russ Allbery <r...@stanford.edu> + * Written by Russ Allbery <ea...@eyrie.org> * * The authors hereby relinquish any claim to any copyright that they may have * in this work, whether granted under contract or by operation of law or ------------------------------ _______________________________________________ inn-committers mailing list inn-committers@lists.isc.org https://lists.isc.org/mailman/listinfo/inn-committers End of inn-committers Digest, Vol 67, Issue 3 *********************************************