From ad109aba29f3594eac6202fbb8550b20f372d64e Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 11 Aug 2016 22:31:08 +0000 Subject: [PATCH] tests: fix *stat64 tests on alpha On some architectures including alpha, provides a definition of struct stat that has no st_atime_nsec, st_mtime_nsec, and st_ctime_nsec fields. At the same time, struct stat64 always has these fields. Fix tests to take this difference into account. * tests/fstat64.c (STRUCT_STAT_IS_STAT64): New macro, defined to 1. * tests/lstat64.c (STRUCT_STAT_IS_STAT64): Likewise. * tests/stat64.c (STRUCT_STAT_IS_STAT64): Likewise. * tests/xstatx.c [!STRUCT_STAT] (STRUCT_STAT_IS_STAT64): New macro, defined to 0. [USE_ASM_STAT && STRUCT_STAT_IS_STAT64]: (HAVE_STRUCT_STAT_ST_ATIME_NSEC, HAVE_STRUCT_STAT_ST_CTIME_NSEC, HAVE_STRUCT_STAT_ST_MTIME_NSEC): Redefine to 1. --- tests/fstat64.c | 1 + tests/lstat64.c | 1 + tests/stat64.c | 1 + tests/xstatx.c | 25 +++++++++++++++++-------- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/fstat64.c b/tests/fstat64.c index 0a69e321..cf147df3 100644 --- a/tests/fstat64.c +++ b/tests/fstat64.c @@ -34,6 +34,7 @@ # define TEST_SYSCALL_STR "fstat64" # define STRUCT_STAT struct stat64 # define STRUCT_STAT_STR "struct stat64" +# define STRUCT_STAT_IS_STAT64 1 # define SAMPLE_SIZE ((libc_off_t) 43147718418) # include "fstatx.c" diff --git a/tests/lstat64.c b/tests/lstat64.c index c6f13193..68ef638b 100644 --- a/tests/lstat64.c +++ b/tests/lstat64.c @@ -34,6 +34,7 @@ # define TEST_SYSCALL_STR "lstat64" # define STRUCT_STAT struct stat64 # define STRUCT_STAT_STR "struct stat64" +# define STRUCT_STAT_IS_STAT64 1 # define SAMPLE_SIZE ((libc_off_t) 43147718418) # include "lstatx.c" diff --git a/tests/stat64.c b/tests/stat64.c index 0b53f9ae..4c2101bb 100644 --- a/tests/stat64.c +++ b/tests/stat64.c @@ -34,6 +34,7 @@ # define TEST_SYSCALL_STR "stat64" # define STRUCT_STAT struct stat64 # define STRUCT_STAT_STR "struct stat64" +# define STRUCT_STAT_IS_STAT64 1 # define SAMPLE_SIZE ((libc_off_t) 43147718418) # include "lstatx.c" diff --git a/tests/xstatx.c b/tests/xstatx.c index a9fb8e8a..f23d0cd7 100644 --- a/tests/xstatx.c +++ b/tests/xstatx.c @@ -71,6 +71,15 @@ print_time(const time_t t) printf("%llu", (unsigned long long) t); } +# ifndef STRUCT_STAT +# define STRUCT_STAT struct stat +# define STRUCT_STAT_STR "struct stat" +# define STRUCT_STAT_IS_STAT64 0 +# endif +# ifndef SAMPLE_SIZE +# define SAMPLE_SIZE 43147718418 +# endif + typedef off_t libc_off_t; # ifdef USE_ASM_STAT @@ -109,6 +118,14 @@ typedef off_t libc_off_t; # define time_t __kernel_time_t # define uid_t __kernel_uid_t # include "asm_stat.h" +# if STRUCT_STAT_IS_STAT64 +# undef HAVE_STRUCT_STAT_ST_ATIME_NSEC +# define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1 +# undef HAVE_STRUCT_STAT_ST_CTIME_NSEC +# define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1 +# undef HAVE_STRUCT_STAT_ST_MTIME_NSEC +# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1 +# endif /* STRUCT_STAT_IS_STAT64 */ # else # undef HAVE_STRUCT_STAT_ST_ATIME_NSEC # ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC @@ -130,14 +147,6 @@ typedef off_t libc_off_t; # endif # endif -# ifndef STRUCT_STAT -# define STRUCT_STAT struct stat -# define STRUCT_STAT_STR "struct stat" -# endif -# ifndef SAMPLE_SIZE -# define SAMPLE_SIZE 43147718418 -# endif - static void print_ftype(const unsigned int mode) { -- 2.40.0