[PATCH 2/2] Use the correct m32/mx32 st_mtime_nsec check in tests/xstatx.c

Dmitry V. Levin ldv at altlinux.org
Tue Aug 30 15:59:35 UTC 2016


On Tue, Aug 30, 2016 at 12:50:34AM +0100, James Clarke wrote:
> * 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

I've made a slightly different change based on your patch.  Thanks!

>  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

GNU Automake doesn't like this, so I've moved it to ARCH_MFLAGS.

>  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

This (or something like this) had to be placed inside USE_ASM_STAT section.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160830/8afebc61/attachment.bin>


More information about the Strace-devel mailing list