mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
tests: Fix t-gettime for a time_t of 64 and a long of 32 bit.
* configure.ac (AC_CHECK_HEADERS): Add stdint.h. * common/t-gettime.c: Include stdint.h. (UINTMAX_C): Define replacement. (test_isotime2epoch): Use UINTMAX_C for the >32 bit constants. -- This is for example the case on 32 bit OpenBSD. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
3c00b52f7c
commit
5c0777e1ca
@ -20,9 +20,18 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
/* In case we do not have stdint.h and no other version of that
|
||||||
|
* conversion macro provide shortcut it. */
|
||||||
|
#ifndef UINTMAX_C
|
||||||
|
#define UINTMAX_C (c) (c)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define pass() do { ; } while(0)
|
#define pass() do { ; } while(0)
|
||||||
#define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\
|
#define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\
|
||||||
__FILE__,__LINE__, (a)); \
|
__FILE__,__LINE__, (a)); \
|
||||||
@ -55,10 +64,10 @@ test_isotime2epoch (void)
|
|||||||
{ "20070629T160000\n", 1183132800 },
|
{ "20070629T160000\n", 1183132800 },
|
||||||
{ "20070629T160000.", INVALID },
|
{ "20070629T160000.", INVALID },
|
||||||
#if SIZEOF_TIME_T > 4
|
#if SIZEOF_TIME_T > 4
|
||||||
{ "21060207T062815", (time_t)0x0ffffffff },
|
{ "21060207T062815", (time_t)UINTMAX_C(0x0ffffffff) },
|
||||||
{ "21060207T062816", (time_t)0x100000000 },
|
{ "21060207T062816", (time_t)UINTMAX_C(0x100000000) },
|
||||||
{ "21060207T062817", (time_t)0x100000001 },
|
{ "21060207T062817", (time_t)UINTMAX_C(0x100000001) },
|
||||||
{ "21060711T120001", (time_t)4308292801 },
|
{ "21060711T120001", (time_t)UINTMAX_C(4308292801) },
|
||||||
#endif /*SIZEOF_TIME_T > 4*/
|
#endif /*SIZEOF_TIME_T > 4*/
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
@ -1258,7 +1258,7 @@ AC_MSG_NOTICE([checking for header files])
|
|||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
|
AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
|
||||||
pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h \
|
pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h \
|
||||||
signal.h])
|
stdint.h signal.h])
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user