public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] io: Fix sporadic test failures in io/tst-stat Date: Thu, 10 Jun 2021 11:48:47 +0000 (GMT) [thread overview] Message-ID: <20210610114847.4B78439DC4DE@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=acc85ea1eb046eee9296fbc4803b82cb485ced07 commit acc85ea1eb046eee9296fbc4803b82cb485ced07 Author: Florian Weimer <fweimer@redhat.com> Date: Thu Jun 10 10:09:51 2021 +0200 io: Fix sporadic test failures in io/tst-stat support_stat_nanoseconds cannot restore the ctime time, and this may lead to sporadic test failures. Therefore, probe for nanoseconds support before the initial statx call. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Diff: --- io/tst-stat.c | 8 ++++---- support/support.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/io/tst-stat.c b/io/tst-stat.c index b3e8dc2170..82e965de6a 100644 --- a/io/tst-stat.c +++ b/io/tst-stat.c @@ -69,15 +69,15 @@ do_test (void) TEST_VERIFY_EXIT (fd >= 0); support_write_file_string (path, "abc"); + bool check_ns = support_stat_nanoseconds (path); + if (!check_ns) + printf ("warning: timestamp with nanoseconds not supported\n"); + struct statx stx; TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0); test_t tests[] = { stat_check, lstat_check, fstat_check, fstatat_check }; - bool check_ns = support_stat_nanoseconds (path); - if (!check_ns) - printf ("warning: timestamp with nanoseconds not supported\n"); - for (int i = 0; i < array_length (tests); i++) { struct stat st; diff --git a/support/support.h b/support/support.h index db264e3db7..874204b7fc 100644 --- a/support/support.h +++ b/support/support.h @@ -141,7 +141,8 @@ static __inline bool support_path_support_time64 (const char *path) 0x80000002ULL); } -/* Return true if stat supports nanoseconds resolution. */ +/* Return true if stat supports nanoseconds resolution. PATH is used + for tests and its ctime may change. */ extern bool support_stat_nanoseconds (const char *path); /* Return true if select modify the timeout to reflect the amount of time
reply other threads:[~2021-06-10 11:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210610114847.4B78439DC4DE@sourceware.org \ --to=fw@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /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: linkBe 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).