From 57a5a0095c3fe0f22dcbb9d99a82cc94f2b608c7 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sun, 17 Jan 2016 14:30:53 -0800 Subject: Update to rra-c-util 5.10 and C TAP Harness 3.4 Update to rra-c-util 5.10: * Add missing va_end to xasprintf implementation. * Fix Perl test suite framework for new Automake relative paths. * Improve portability to Kerberos included in Solaris 10. * Use appropriate warning flags with Clang (currently not warning clean). Update to C TAP Harness 3.4: * Fix segfault in runtests with an empty test list. * Display verbose test results with -v or C_TAP_VERBOSE. * Test infrastructure builds cleanly with Clang warnings. * Support comments and blank lines in test lists. --- tests/util/messages-t.c | 5 +++-- tests/util/xmalloc-t | 32 ++++++++++++++++---------------- tests/util/xmalloc.c | 7 +++++-- 3 files changed, 24 insertions(+), 20 deletions(-) (limited to 'tests/util') diff --git a/tests/util/messages-t.c b/tests/util/messages-t.c index f60fa6a..1098314 100644 --- a/tests/util/messages-t.c +++ b/tests/util/messages-t.c @@ -5,7 +5,7 @@ * which can be found at . * * Written by Russ Allbery - * Copyright 2002, 2004, 2005 Russ Allbery + * Copyright 2002, 2004, 2005, 2015 Russ Allbery * Copyright 2009, 2010, 2011, 2012 * The Board of Trustees of the Leland Stanford Junior University * @@ -92,7 +92,8 @@ static void test11(void *data UNUSED) { sysdie("fatal"); } -static void log_msg(size_t len, const char *format, va_list args, int error) { +static void __attribute__((__format__(printf, 2, 0))) +log_msg(size_t len, const char *format, va_list args, int error) { fprintf(stderr, "%lu %d ", (unsigned long) len, error); vfprintf(stderr, format, args); fprintf(stderr, "\n"); diff --git a/tests/util/xmalloc-t b/tests/util/xmalloc-t index d52c448..af604ed 100755 --- a/tests/util/xmalloc-t +++ b/tests/util/xmalloc-t @@ -99,46 +99,46 @@ ok_xmalloc "vasprintf large" 0 "" "v" "30000000" "0" # We assume that there are enough miscellaneous allocations that an allocation # exactly as large as the limit will always fail. ok_xmalloc "malloc fail" 1 \ - "failed to malloc 30000000 bytes at xmalloc.c line 38" \ + "failed to malloc 30000000 bytes at xmalloc.c line 41" \ "m" "30000000" "30000000" ok_xmalloc "realloc fail" 1 \ - "failed to realloc 30000000 bytes at xmalloc.c line 66" \ + "failed to realloc 30000000 bytes at xmalloc.c line 69" \ "r" "30000000" "30000000" ok_xmalloc "reallocarray fail" 1 \ - "failed to reallocarray 30000000 bytes at xmalloc.c line 96" \ + "failed to reallocarray 30000000 bytes at xmalloc.c line 99" \ "y" "30000000" "30000000" ok_xmalloc "strdup fail" 1 \ - "failed to strdup 30000000 bytes at xmalloc.c line 127" \ + "failed to strdup 30000000 bytes at xmalloc.c line 130" \ "s" "30000000" "30000000" ok_xmalloc "strndup fail" 1 \ - "failed to strndup 30000000 bytes at xmalloc.c line 173" \ + "failed to strndup 30000000 bytes at xmalloc.c line 176" \ "n" "30000000" "30000000" ok_xmalloc "calloc fail" 1 \ - "failed to calloc 30000000 bytes at xmalloc.c line 197" \ + "failed to calloc 30000000 bytes at xmalloc.c line 200" \ "c" "30000000" "30000000" ok_xmalloc "asprintf fail" 1 \ - "failed to asprintf 30000000 bytes at xmalloc.c line 221" \ + "failed to asprintf 30000000 bytes at xmalloc.c line 224" \ "a" "30000000" "30000000" ok_xmalloc "vasprintf fail" 1 \ - "failed to vasprintf 30000000 bytes at xmalloc.c line 240" \ + "failed to vasprintf 30000000 bytes at xmalloc.c line 243" \ "v" "30000000" "30000000" # Check our custom error handler. -ok_xmalloc "malloc custom" 1 "malloc 30000000 xmalloc.c 38" \ +ok_xmalloc "malloc custom" 1 "malloc 30000000 xmalloc.c 41" \ "M" "30000000" "30000000" -ok_xmalloc "realloc custom" 1 "realloc 30000000 xmalloc.c 66" \ +ok_xmalloc "realloc custom" 1 "realloc 30000000 xmalloc.c 69" \ "R" "30000000" "30000000" -ok_xmalloc "reallocarray custom" 1 "reallocarray 30000000 xmalloc.c 96" \ +ok_xmalloc "reallocarray custom" 1 "reallocarray 30000000 xmalloc.c 99" \ "Y" "30000000" "30000000" -ok_xmalloc "strdup custom" 1 "strdup 30000000 xmalloc.c 127" \ +ok_xmalloc "strdup custom" 1 "strdup 30000000 xmalloc.c 130" \ "S" "30000000" "30000000" -ok_xmalloc "strndup custom" 1 "strndup 30000000 xmalloc.c 173" \ +ok_xmalloc "strndup custom" 1 "strndup 30000000 xmalloc.c 176" \ "N" "30000000" "30000000" -ok_xmalloc "calloc custom" 1 "calloc 30000000 xmalloc.c 197" \ +ok_xmalloc "calloc custom" 1 "calloc 30000000 xmalloc.c 200" \ "C" "30000000" "30000000" -ok_xmalloc "asprintf custom" 1 "asprintf 30000000 xmalloc.c 221" \ +ok_xmalloc "asprintf custom" 1 "asprintf 30000000 xmalloc.c 224" \ "A" "30000000" "30000000" -ok_xmalloc "vasprintf custom" 1 "vasprintf 30000000 xmalloc.c 240" \ +ok_xmalloc "vasprintf custom" 1 "vasprintf 30000000 xmalloc.c 243" \ "V" "30000000" "30000000" # Check the smaller ones again just for grins. diff --git a/tests/util/xmalloc.c b/tests/util/xmalloc.c index e222612..84ba081 100644 --- a/tests/util/xmalloc.c +++ b/tests/util/xmalloc.c @@ -34,7 +34,10 @@ #include #include -#include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include /* Linux requires sys/time.h be included before sys/resource.h. */ #include @@ -261,7 +264,7 @@ test_asprintf(size_t size) /* Wrapper around vasprintf to do the va_list stuff. */ -static void +static void __attribute__((__format__(printf, 2, 3))) xvasprintf_wrapper(char **strp, const char *format, ...) { va_list args; -- cgit v1.2.3