]> granicus.if.org Git - strace/commitdiff
tests: fix *stat64 tests on alpha
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Aug 2016 22:31:08 +0000 (22:31 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 12 Aug 2016 00:07:54 +0000 (00:07 +0000)
On some architectures including alpha, <asm/stat.h> 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
tests/lstat64.c
tests/stat64.c
tests/xstatx.c

index 0a69e3219e219368eca972eb60cb26ae470a961b..cf147df3c0ef79c76456c064f5c2d5a4f5274347 100644 (file)
@@ -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"
 
index c6f131936bf4684f2b88a9158deb18aa091125cb..68ef638beccdc7b706a9cfafdfcca4d5e0071b9f 100644 (file)
@@ -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"
 
index 0b53f9aeca3428386be9ab9ae7cc64f128a81bd8..4c2101bb675bbbbee4f89082f817d84a22842eb5 100644 (file)
@@ -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"
 
index a9fb8e8a5e8e49a7688d27b717a6d5a8e72045e5..f23d0cd715d1ba757da4f18a84064cb417feb145 100644 (file)
@@ -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)
 {