[PATCH 2/2] Use the correct m32/mx32 st_mtime_nsec check in tests/xstatx.c
James Clarke
jrtc27 at jrtc27.com
Mon Aug 29 23:50:34 UTC 2016
* tests/Makefile.am: Define MPERS_IS_m(x)32 for mpers builds.
* tests/xstatx.c: Use the correct m32/mx32 and stat/stat64 macros when
checking if st_mtime_nsec exists.
---
Hi,
This fixes tests-m32 failures for the *stat.c (32-bit native) test cases, as
sparc64's stat does not have nsec, but sparc's does, so xstatx.c wasn't
printing the nsec (but strace itself was correctly printing it). It doesn't
look quite right given there's a whole load of other nsec stuff above it, but
it's sufficient on sparc64. I don't expect it to be committed as-is, but
hopefully it's helpful.
Regards,
Hames
tests/Makefile.am | 3 +++
tests/xstatx.c | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0c28f06..26d5a3a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -38,6 +38,9 @@ AM_CPPFLAGS = $(ARCH_MFLAGS) \
-I$(top_srcdir)/$(OS) \
-I$(top_builddir) \
-I$(top_srcdir)
+ifneq ($(MPERS_NAME),)
+AM_CPPFLAGS += -DMPERS_IS_$(MPERS_NAME)
+endif
AM_LDFLAGS = $(ARCH_MFLAGS)
libtests_a_SOURCES = \
diff --git a/tests/xstatx.c b/tests/xstatx.c
index 359ee1d..8dbe89f 100644
--- a/tests/xstatx.c
+++ b/tests/xstatx.c
@@ -108,6 +108,30 @@ typedef off_t libc_off_t;
# endif /* HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */
# endif
+# if defined MPERS_IS_m32
+# undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
+# if STRUCT_STAT_IS_STAT64
+# ifdef HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC
+# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
+# endif /* HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC */
+# else
+# ifdef HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC
+# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
+# endif /* HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC */
+# endif /* STRUCT_STAT_IS_STAT64 */
+# elif defined MPERS_IS_mx32
+# undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
+# if STRUCT_STAT_IS_STAT64
+# ifdef HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC
+# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
+# endif /* HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC */
+# else
+# ifdef HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC
+# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
+# endif /* HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC */
+# endif /* STRUCT_STAT_IS_STAT64 */
+# endif
+
static void
print_ftype(const unsigned int mode)
{
--
2.9.3
More information about the Strace-devel
mailing list