public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Stefan Liebler <stli@linux.ibm.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] Don't test nanoseconds for non-LFS interface in io/tst-stat.c
Date: Tue, 16 Mar 2021 11:24:10 -0300	[thread overview]
Message-ID: <dfbeda05-3d9f-6ecc-9331-cad7f4ffb352@linaro.org> (raw)
In-Reply-To: <20210316135612.1400708-1-stli@linux.ibm.com>



On 16/03/2021 10:56, Stefan Liebler wrote:
> Both new tests io/tst-stat and io/tst-stat-lfs (_FILE_OFFSET_BITS=64)
> are comparing the nanosecond fields with the statx result.  Unfortunately
> e.g. on s390(31bit) those fields are always zero if old KABI with non-LFS
> support is used.  With _FILE_OFFSET_BITS=64 stat is using statx internally.

This might also happens for LFS interface if statx is not supported by the
kernel, since the LFS call will fall back to the use the stat syscall that
has this issue.

Maybe it would be better to make it an internal tests and add a flag
somewhere to just disable it for s390-32. 

> 
> As suggested by Adhemerval this patch disables the nanosecond check for
> non-LFS interface.
> ---
>  io/tst-stat.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/io/tst-stat.c b/io/tst-stat.c
> index 445ac4176c..550128a2a5 100644
> --- a/io/tst-stat.c
> +++ b/io/tst-stat.c
> @@ -26,6 +26,20 @@
>  #include <sys/stat.h>
>  #include <sys/sysmacros.h>
>  #include <unistd.h>
> +#include <kernel_stat.h>
> +
> +#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
> +/* Test nanoseconds if LFS interface is requested.  */
> +# define TEST_NANOSECONDS 1
> +#elif !XSTAT_IS_XSTAT64
> +/* LFS interface is not requested and we have no LFS support.  E.g. s390(31bit)
> +   is using old KABI with old non-LFS support and the nanoseconds fields are
> +   always zero.  */
> +# define TEST_NANOSECONDS 0
> +#else
> +/* LFS interface is not requested, but we have LFS support.  */
> +# define TEST_NANOSECONDS 1
> +#endif
>  
>  static void
>  stat_check (int fd, const char *path, struct stat *st)
> @@ -91,9 +105,11 @@ do_test (void)
>        TEST_COMPARE (stx.stx_blocks, st.st_blocks);
>  
>        TEST_COMPARE (stx.stx_ctime.tv_sec, st.st_ctim.tv_sec);
> -      TEST_COMPARE (stx.stx_ctime.tv_nsec, st.st_ctim.tv_nsec);
>        TEST_COMPARE (stx.stx_mtime.tv_sec, st.st_mtim.tv_sec);
> +#if TEST_NANOSECONDS
> +      TEST_COMPARE (stx.stx_ctime.tv_nsec, st.st_ctim.tv_nsec);
>        TEST_COMPARE (stx.stx_mtime.tv_nsec, st.st_mtim.tv_nsec);
> +#endif
>      }
>  
>    return 0;
> 

  reply	other threads:[~2021-03-16 14:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 13:56 Stefan Liebler
2021-03-16 14:24 ` Adhemerval Zanella [this message]
2021-03-16 16:30   ` Stefan Liebler
2021-03-16 19:59     ` Adhemerval Zanella
2021-03-17 13:04       ` Stefan Liebler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfbeda05-3d9f-6ecc-9331-cad7f4ffb352@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=stli@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).