Commit 57a5a009 authored by Russ Allbery's avatar Russ Allbery
Browse files

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.
parent 884297fc
# Automake makefile for wallet. # Automake makefile for wallet.
# #
# Written by Russ Allbery <eagle@eyrie.org> # Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2016 Russ Allbery <eagle@eyrie.org>
# Copyright 2006, 2007, 2008, 2010, 2013, 2014 # Copyright 2006, 2007, 2008, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University # The Board of Trustees of the Leland Stanford Junior University
# #
...@@ -173,22 +174,28 @@ dist_pkgdata_DATA = perl/sql/Wallet-Schema-0.07-0.08-MySQL.sql \ ...@@ -173,22 +174,28 @@ dist_pkgdata_DATA = perl/sql/Wallet-Schema-0.07-0.08-MySQL.sql \
perl/sql/Wallet-Schema-0.09-PostgreSQL.sql \ perl/sql/Wallet-Schema-0.09-PostgreSQL.sql \
perl/sql/Wallet-Schema-0.09-SQLite.sql perl/sql/Wallet-Schema-0.09-SQLite.sql
# A set of flags for warnings. Add -O because gcc won't find some warnings # A set of flags for warnings. Add -O because gcc won't find some warnings
# without optimization turned on. Desirable warnings that can't be turned # without optimization turned on. Desirable warnings that can't be turned
# on due to other problems: # on due to other problems:
# #
# -Wconversion http://bugs.debian.org/488884 (htons warnings) # -Wconversion http://bugs.debian.org/488884 (htons warnings)
# #
# Last checked against gcc 4.8.2 (2014-04-12). -D_FORTIFY_SOURCE=2 enables # Last checked against gcc 4.8.2 (2014-04-12). -D_FORTIFY_SOURCE=2 enables
# warn_unused_result attribute markings on glibc functions on Linux, which # warn_unused_result attribute markings on glibc functions on Linux, which
# catches a few more issues. # catches a few more issues.
WARNINGS = -g -O -fstrict-overflow -fstrict-aliasing -D_FORTIFY_SOURCE=2 \ if WARNINGS_GCC
-Wall -Wextra -Wendif-labels -Wformat=2 -Winit-self -Wswitch-enum \ WARNINGS = -g -O -fstrict-overflow -fstrict-aliasing -D_FORTIFY_SOURCE=2 \
-Wstrict-overflow=5 -Wfloat-equal -Wdeclaration-after-statement \ -Wall -Wextra -Wendif-labels -Wformat=2 -Winit-self -Wswitch-enum \
-Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align \ -Wstrict-overflow=5 -Wmissing-format-attribute -Wfloat-equal \
-Wwrite-strings -Wjump-misses-init -Wlogical-op -Wstrict-prototypes \ -Wdeclaration-after-statement -Wshadow -Wpointer-arith \
-Wold-style-definition -Wmissing-prototypes -Wnormalized=nfc \ -Wbad-function-cast -Wcast-align -Wwrite-strings -Wjump-misses-init \
-Wpacked -Wredundant-decls -Wnested-externs -Winline -Wvla -Werror -Wlogical-op -Wstrict-prototypes -Wold-style-definition \
-Wmissing-prototypes -Wnormalized=nfc -Wpacked -Wredundant-decls \
-Wnested-externs -Winline -Wvla -Werror
endif
if WARNINGS_CLANG
WARNINGS = -Weverything -Wno-padded
endif
warnings: warnings:
$(MAKE) V=0 CFLAGS='$(WARNINGS)' KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)' $(MAKE) V=0 CFLAGS='$(WARNINGS)' KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)'
......
...@@ -79,6 +79,20 @@ wallet 1.3 (unreleased) ...@@ -79,6 +79,20 @@ wallet 1.3 (unreleased)
package version except for Wallet::Schema, which is used to version package version except for Wallet::Schema, which is used to version
the database schema. the database schema.
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.
wallet 1.2 (2014-12-08) wallet 1.2 (2014-12-08)
The duo object type has been split into several sub-types, each for a The duo object type has been split into several sub-types, each for a
......
...@@ -15,10 +15,14 @@ AM_INIT_AUTOMAKE([1.11 check-news dist-xz foreign silent-rules subdir-objects ...@@ -15,10 +15,14 @@ AM_INIT_AUTOMAKE([1.11 check-news dist-xz foreign silent-rules subdir-objects
-Wall -Wno-override -Werror]) -Wall -Wno-override -Werror])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
dnl Detect unexpanded macros.
m4_pattern_forbid([^_?RRA_])
dnl AM_PROG_AR is required for Automake 1.12 by Libtool but not defined at all dnl AM_PROG_AR is required for Automake 1.12 by Libtool but not defined at all
dnl (or needed) in Automake 1.11. Work around this bug. dnl (or needed) in Automake 1.11. Work around this bug.
AC_PROG_CC AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS AC_USE_SYSTEM_EXTENSIONS
RRA_PROG_CC_CLANG
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
AM_PROG_CC_C_O AM_PROG_CC_C_O
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
...@@ -56,8 +60,8 @@ RRA_LIB_KRB5_RESTORE ...@@ -56,8 +60,8 @@ RRA_LIB_KRB5_RESTORE
dnl Probe for properties of the C library. dnl Probe for properties of the C library.
AC_HEADER_STDBOOL AC_HEADER_STDBOOL
AC_CHECK_HEADERS([sys/bitypes.h sys/uio.h syslog.h]) AC_CHECK_HEADERS([sys/bitypes.h sys/uio.h sys/time.h syslog.h])
AC_CHECK_DECLS([snprintf, vsnprintf]) AC_CHECK_DECLS([snprintf, strlcat, strlcpy, vsnprintf])
RRA_C_C99_VAMACROS RRA_C_C99_VAMACROS
RRA_C_GNU_VAMACROS RRA_C_GNU_VAMACROS
AC_TYPE_LONG_LONG_INT AC_TYPE_LONG_LONG_INT
......
dnl Determine whether the current compiler is Clang.
dnl
dnl If the current compiler is Clang, set the shell variable CLANG to yes.
dnl
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
dnl Copyright 2015 Russ Allbery <eagle@eyrie.org>
dnl
dnl This file is free software; the authors give unlimited permission to copy
dnl and/or distribute it, with or without modifications, as long as this
dnl notice is preserved.
dnl Source used by RRA_PROG_CC_CLANG.
AC_DEFUN([_RRA_PROG_CC_CLANG_SOURCE], [[
#if ! __clang__
#error
#endif
]])
AC_DEFUN([RRA_PROG_CC_CLANG],
[AC_CACHE_CHECK([if the compiler is Clang], [rra_cv_prog_cc_clang],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_PROG_CC_CLANG_SOURCE])],
[rra_cv_prog_cc_clang=yes],
[rra_cv_prog_cc_clang=no])])
AS_IF([test x"$rra_cv_prog_cc_clang" = xyes], [CLANG=yes])])
...@@ -64,6 +64,8 @@ dnl Headers to include when probing for Kerberos library properties. ...@@ -64,6 +64,8 @@ dnl Headers to include when probing for Kerberos library properties.
AC_DEFUN([RRA_INCLUDES_KRB5], [[ AC_DEFUN([RRA_INCLUDES_KRB5], [[
#if HAVE_KRB5_H #if HAVE_KRB5_H
# include <krb5.h> # include <krb5.h>
#elif HAVE_KERBEROSV5_KRB5_H
# include <kerberosv5/krb5.h>
#else #else
# include <krb5/krb5.h> # include <krb5/krb5.h>
#endif #endif
...@@ -113,6 +115,23 @@ AC_DEFUN([_RRA_LIB_KRB5_CHECK_HEADER], ...@@ -113,6 +115,23 @@ AC_DEFUN([_RRA_LIB_KRB5_CHECK_HEADER],
AC_MSG_RESULT([yes])], AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])]) [AC_MSG_RESULT([no])])])
dnl Check for the com_err header. Internal helper macro since we need
dnl to do the same checks in multiple places.
AC_DEFUN([_RRA_LIB_KRB5_CHECK_HEADER_COM_ERR],
[AS_IF([test x"$rra_krb5_incroot" = x],
[AC_CHECK_HEADERS([et/com_err.h kerberosv5/com_err.h])],
[_RRA_LIB_KRB5_CHECK_HEADER([et/com_err.h])
_RRA_LIB_KRB5_CHECK_HEADER([kerberosv5/com_err.h])])])
dnl Check for the main Kerberos header. Internal helper macro since we need
dnl to do the same checks in multiple places.
AC_DEFUN([_RRA_LIB_KRB5_CHECK_HEADER_KRB5],
[AS_IF([test x"$rra_krb5_incroot" = x],
[AC_CHECK_HEADERS([krb5.h kerberosv5/krb5.h krb5/krb5.h])],
[_RRA_LIB_KRB5_CHECK_HEADER([krb5.h])
_RRA_LIB_KRB5_CHECK_HEADER([kerberosv5/krb5.h])
_RRA_LIB_KRB5_CHECK_HEADER([krb5/krb5.h])])])
dnl Does the appropriate library checks for reduced-dependency Kerberos dnl Does the appropriate library checks for reduced-dependency Kerberos
dnl linkage. The single argument, if true, says to fail if Kerberos could not dnl linkage. The single argument, if true, says to fail if Kerberos could not
dnl be found. dnl be found.
...@@ -122,10 +141,7 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED], ...@@ -122,10 +141,7 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED],
[AS_IF([test x"$1" = xtrue], [AS_IF([test x"$1" = xtrue],
[AC_MSG_ERROR([cannot find usable Kerberos library])])]) [AC_MSG_ERROR([cannot find usable Kerberos library])])])
LIBS="$KRB5_LIBS $LIBS" LIBS="$KRB5_LIBS $LIBS"
AS_IF([test x"$rra_krb5_incroot" = x], _RRA_LIB_KRB5_CHECK_HEADER_KRB5
[AC_CHECK_HEADERS([krb5.h krb5/krb5.h])],
[_RRA_LIB_KRB5_CHECK_HEADER([krb5.h])
_RRA_LIB_KRB5_CHECK_HEADER([krb5/krb5.h])])
AC_CHECK_FUNCS([krb5_get_error_message], AC_CHECK_FUNCS([krb5_get_error_message],
[AC_CHECK_FUNCS([krb5_free_error_message])], [AC_CHECK_FUNCS([krb5_free_error_message])],
[AC_CHECK_FUNCS([krb5_get_error_string], [], [AC_CHECK_FUNCS([krb5_get_error_string], [],
...@@ -140,7 +156,7 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED], ...@@ -140,7 +156,7 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED],
[AS_IF([test x"$1" = xtrue], [AS_IF([test x"$1" = xtrue],
[AC_MSG_ERROR([cannot find usable com_err library])], [AC_MSG_ERROR([cannot find usable com_err library])],
[KRB5_LIBS=""])]) [KRB5_LIBS=""])])
AC_CHECK_HEADERS([et/com_err.h])])])])]) _RRA_LIB_KRB5_CHECK_HEADER_COM_ERR])])])])
RRA_LIB_KRB5_RESTORE]) RRA_LIB_KRB5_RESTORE])
dnl Does the appropriate library checks for Kerberos linkage when we don't dnl Does the appropriate library checks for Kerberos linkage when we don't
...@@ -187,10 +203,7 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], ...@@ -187,10 +203,7 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL],
[$rra_krb5_extra])], [$rra_krb5_extra])],
[-lasn1 -lcom_err -lcrypto $rra_krb5_extra]) [-lasn1 -lcom_err -lcrypto $rra_krb5_extra])
LIBS="$KRB5_LIBS $LIBS" LIBS="$KRB5_LIBS $LIBS"
AS_IF([test x"$rra_krb5_incroot" = x], _RRA_LIB_KRB5_CHECK_HEADER_KRB5
[AC_CHECK_HEADERS([krb5.h krb5/krb5.h])],
[_RRA_LIB_KRB5_CHECK_HEADER([krb5.h])
_RRA_LIB_KRB5_CHECK_HEADER([krb5/krb5.h])])
AC_CHECK_FUNCS([krb5_get_error_message], AC_CHECK_FUNCS([krb5_get_error_message],
[AC_CHECK_FUNCS([krb5_free_error_message])], [AC_CHECK_FUNCS([krb5_free_error_message])],
[AC_CHECK_FUNCS([krb5_get_error_string], [], [AC_CHECK_FUNCS([krb5_get_error_string], [],
...@@ -198,7 +211,7 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], ...@@ -198,7 +211,7 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL],
[AC_CHECK_FUNCS([krb5_svc_get_msg], [AC_CHECK_FUNCS([krb5_svc_get_msg],
[AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [],
[RRA_INCLUDES_KRB5])], [RRA_INCLUDES_KRB5])],
[AC_CHECK_HEADERS([et/com_err.h])])])])]) [_RRA_LIB_KRB5_CHECK_HEADER_COM_ERR])])])])
RRA_LIB_KRB5_RESTORE]) RRA_LIB_KRB5_RESTORE])
dnl Sanity-check the results of krb5-config and be sure we can really link a dnl Sanity-check the results of krb5-config and be sure we can really link a
...@@ -222,10 +235,7 @@ AC_DEFUN([_RRA_LIB_KRB5_CONFIG], ...@@ -222,10 +235,7 @@ AC_DEFUN([_RRA_LIB_KRB5_CONFIG],
[RRA_KRB5_CONFIG([${rra_krb5_root}], [krb5], [KRB5], [RRA_KRB5_CONFIG([${rra_krb5_root}], [krb5], [KRB5],
[_RRA_LIB_KRB5_CHECK([$1]) [_RRA_LIB_KRB5_CHECK([$1])
RRA_LIB_KRB5_SWITCH RRA_LIB_KRB5_SWITCH
AS_IF([test x"$rra_krb5_incroot" = x], _RRA_LIB_KRB5_CHECK_HEADER_KRB5
[AC_CHECK_HEADERS([krb5.h krb5/krb5.h])],
[_RRA_LIB_KRB5_CHECK_HEADER([krb5.h])
_RRA_LIB_KRB5_CHECK_HEADER([krb5/krb5.h])])
AC_CHECK_FUNCS([krb5_get_error_message], AC_CHECK_FUNCS([krb5_get_error_message],
[AC_CHECK_FUNCS([krb5_free_error_message])], [AC_CHECK_FUNCS([krb5_free_error_message])],
[AC_CHECK_FUNCS([krb5_get_error_string], [], [AC_CHECK_FUNCS([krb5_get_error_string], [],
...@@ -233,7 +243,7 @@ AC_DEFUN([_RRA_LIB_KRB5_CONFIG], ...@@ -233,7 +243,7 @@ AC_DEFUN([_RRA_LIB_KRB5_CONFIG],
[AC_CHECK_FUNCS([krb5_svc_get_msg], [AC_CHECK_FUNCS([krb5_svc_get_msg],
[AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [],
[RRA_INCLUDES_KRB5])], [RRA_INCLUDES_KRB5])],
[AC_CHECK_HEADERS([et/com_err.h])])])])]) [_RRA_LIB_KRB5_CHECK_HEADER_COM_ERR])])])])
RRA_LIB_KRB5_RESTORE], RRA_LIB_KRB5_RESTORE],
[_RRA_LIB_KRB5_PATHS [_RRA_LIB_KRB5_PATHS
_RRA_LIB_KRB5_MANUAL([$1])])]) _RRA_LIB_KRB5_MANUAL([$1])])])
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include <config.h> #include <config.h>
#include <portable/macros.h>
#include <portable/system.h> #include <portable/system.h>
#include <errno.h> #include <errno.h>
...@@ -28,11 +29,14 @@ ...@@ -28,11 +29,14 @@
* with the system versions. * with the system versions.
*/ */
#if TESTING #if TESTING
# undef asprintf
# undef vasprintf
# define asprintf test_asprintf # define asprintf test_asprintf
# define vasprintf test_vasprintf # define vasprintf test_vasprintf
int test_asprintf(char **, const char *, ...) int test_asprintf(char **, const char *, ...)
__attribute__((__format__(printf, 2, 3))); __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)));
#endif #endif
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <config.h> #include <config.h>
#include <portable/krb5.h> #include <portable/krb5.h>
#include <portable/macros.h>
#include <portable/system.h> #include <portable/system.h>
#include <errno.h> #include <errno.h>
...@@ -33,6 +34,8 @@ ...@@ -33,6 +34,8 @@
# include <ibm_svc/krb5_svc.h> # include <ibm_svc/krb5_svc.h>
# elif defined(HAVE_ET_COM_ERR_H) # elif defined(HAVE_ET_COM_ERR_H)
# include <et/com_err.h> # include <et/com_err.h>
# elif defined(HAVE_KERBEROSV5_COM_ERR_H)
# include <kerberosv5/com_err.h>
# else # else
# include <com_err.h> # include <com_err.h>
# endif # endif
......
...@@ -42,8 +42,10 @@ ...@@ -42,8 +42,10 @@
#endif #endif
#include <portable/macros.h> #include <portable/macros.h>
#ifdef HAVE_KRB5_H #if defined(HAVE_KRB5_H)
# include <krb5.h> # include <krb5.h>
#elif defined(HAVE_KERBEROSV5_KRB5_H)
# include <kerberosv5/krb5.h>
#else #else
# include <krb5/krb5.h> # include <krb5/krb5.h>
#endif #endif
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
* variadic macro support. * variadic macro support.
*/ */
#if !defined(__attribute__) && !defined(__alloc_size__) #if !defined(__attribute__) && !defined(__alloc_size__)
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) # if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)) \
&& !defined(__clang__)
# define __alloc_size__(spec, args...) /* empty */ # define __alloc_size__(spec, args...) /* empty */
# endif # endif
#endif #endif
......
...@@ -23,7 +23,10 @@ ...@@ -23,7 +23,10 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/time.h> #ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <time.h>
/* /*
* If we're running the test suite, rename mkstemp to avoid conflicts with the * If we're running the test suite, rename mkstemp to avoid conflicts with the
......
/* /*
* Replacement for a missing reallocarray. * Replacement for a missing reallocarray.
* *
* Provides the same functionality as the OpenBSD library function reallocrray * Provides the same functionality as the OpenBSD library function
* for those systems that don't have it. This function is the same as * reallocarray for those systems that don't have it. This function is the
* realloc, but takes the size arguments in the same form as calloc and checks * same as realloc, but takes the size arguments in the same form as calloc
* for overflow so that the caller doesn't need to. * and checks for overflow so that the caller doesn't need to.
* *
* The canonical version of this file is maintained in the rra-c-util package, * 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/>. * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
* the system version. * the system version.
*/ */
#if TESTING #if TESTING
# undef setenv
# define setenv test_setenv # define setenv test_setenv
int test_setenv(const char *, const char *, int); int test_setenv(const char *, const char *, int);
#endif #endif
...@@ -34,29 +35,22 @@ int ...@@ -34,29 +35,22 @@ int
setenv(const char *name, const char *value, int overwrite) setenv(const char *name, const char *value, int overwrite)
{ {
char *envstring; char *envstring;
size_t size;
/* Do nothing if not overwriting and the variable is already set. */
if (!overwrite && getenv(name) != NULL) if (!overwrite && getenv(name) != NULL)
return 0; return 0;
/*
* Allocate memory for the environment string. We intentionally don't use
* the xmalloc family of allocation routines here, since the intention is
* to provide a replacement for the standard library function that sets
* errno and returns in the event of a memory allocation failure.
*/
size = strlen(name) + 1 + strlen(value) + 1;
envstring = malloc(size);
if (envstring == NULL)
return -1;
/* /*
* Build the environment string and add it to the environment using * Build the environment string and add it to the environment using
* putenv. Systems without putenv lose, but XPG4 requires it. * putenv. Systems without putenv lose, but XPG4 requires it.
*
* We intentionally don't use the xmalloc family of allocation routines
* here, since the intention is to provide a replacement for the standard
* library function that sets errno and returns in the event of a memory
* allocation failure.
*/ */
strlcpy(envstring, name, size); if (asprintf(&envstring, "%s=%s", name, value) < 0)
strlcat(envstring, "=", size); return -1;
strlcat(envstring, value, size);
return putenv(envstring); return putenv(envstring);
/* /*
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* conflicts with the system version. * conflicts with the system version.
*/ */
#if TESTING #if TESTING
# undef snprintf
# undef vsnprintf
# define snprintf test_snprintf # define snprintf test_snprintf
# define vsnprintf test_vsnprintf # define vsnprintf test_vsnprintf
#endif #endif
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
* the system version. * the system version.
*/ */
#if TESTING #if TESTING
# undef strlcat
# define strlcat test_strlcat # define strlcat test_strlcat
size_t test_strlcat(char *, const char *, size_t); size_t test_strlcat(char *, const char *, size_t);
#endif #endif
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
* the system version. * the system version.
*/ */
#if TESTING #if TESTING
# undef strlcpy
# define strlcpy test_strlcpy # define strlcpy test_strlcpy
size_t test_strlcpy(char *, const char *, size_t); size_t test_strlcpy(char *, const char *, size_t);
#endif #endif
......
...@@ -136,10 +136,10 @@ extern void *reallocarray(void *, size_t, size_t); ...@@ -136,10 +136,10 @@ extern void *reallocarray(void *, size_t, size_t);
#if !HAVE_SETENV #if !HAVE_SETENV
extern int setenv(const char *, const char *, int); extern int setenv(const char *, const char *, int);
#endif #endif
#if !HAVE_STRLCAT #if !HAVE_DECL_STRLCAT
extern size_t strlcat(char *, const char *, size_t); extern size_t strlcat(char *, const char *, size_t);
#endif #endif
#if !HAVE_STRLCPY #if !HAVE_DECL_STRLCPY
extern size_t strlcpy(char *, const char *, size_t); extern size_t strlcpy(char *, const char *, size_t);
#endif #endif
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <config.h> #include <config.h>
#include <portable/macros.h>
#include <portable/system.h> #include <portable/system.h>
#include <tests/tap/basic.h> #include <tests/tap/basic.h>
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
* Disable the requirement that format strings be literals. We need variable * Disable the requirement that format strings be literals. We need variable
* formats for easy testing. * formats for easy testing.
*/ */
#pragma GCC diagnostic ignored "-Wformat-nonliteral" #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) || defined(__clang__)
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
/* /*
* Intentionally don't add the printf attribute here since we pass a * Intentionally don't add the printf attribute here since we pass a
......
...@@ -3,15 +3,19 @@ ...@@ -3,15 +3,19 @@
* *
* Usage: * Usage:
* *
* runtests [-b <build-dir>] [-s <source-dir>] <test-list> * runtests [-hv] [-b <build-dir>] [-s <source-dir>] -l <test-list>
* runtests -o [-b <build-dir>] [-s <source-dir>] <test> * runtests [-hv] [-b <build-dir>] [-s <source-dir>] <test> [<test> ...]
* runtests -o [-h] [-b <build-dir>] [-s <source-dir>] <test>
* *
* In the first case, expects a list of executables located in the given file, * In the first case, expects a list of executables located in the given file,
* one line per executable. For each one, runs it as part of a test suite, * one line per executable. For each one, runs it as part of a test suite,
* reporting results. Test output should start with a line containing the * reporting results. In the second case, use the same infrastructure, but
* number of tests (numbered from 1 to this number), optionally preceded by * run only the tests listed on the command line.
* "1..", although that line may be given anywhere in the output. Each *
* additional line should be in the following format: * Test output should start with a line containing the number of tests
* (numbered from 1 to this number), optionally preceded by "1..", although
* that line may be given anywhere in the output. Each additional line should
* be in the following format:
* *
* ok <number> * ok <number>
* not ok <number> * not ok <number>
...@@ -50,12 +54,16 @@ ...@@ -50,12 +54,16 @@
* directories. These paths can also be set with the -b and -s command-line * directories. These paths can also be set with the -b and -s command-line
* options, which will override anything set at build time. * options, which will override anything set at build time.
* *
* 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 * 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 * should be sent to the e-mail address below. This program is part of C TAP
* Harness <http://www.eyrie.org/~eagle/software/c-tap-harness/>. * Harness <http://www.eyrie.org/~eagle/software/c-tap-harness/>.
* *
* Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, * Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
* 2014 Russ Allbery <eagle@eyrie.org> * 2014, 2015 Russ Allbery <eagle@eyrie.org>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
...@@ -146,6 +154,12 @@ enum test_status { ...@@ -146,6 +154,12 @@ enum test_status {
TEST_INVALID TEST_INVALID
}; };
/* Really, just a boolean, but this is more self-documenting. */
enum test_verbose {
CONCISE = 0,
VERBOSE = 1
};