Re: [PATCH] stdio-common: Avoid spurious mtime/ctime-related failure in tst-fseek
Adhemerval Zanella Netto <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Organization | Linaro |
| Message-ID | <[email protected]> |
On 02/09/26 08:47, Florian Weimer wrote:
> The test seems to use the timestamps to verify that the file
> has been written as part of the buffer flush. Any change should
> be sufficient. Using the nanosecond field means that if the
> second field does not change due to clock rounding differences,
> the test does not fail unexpectedly.
>
> This was originally observed as a failure on s390x-linux-gnu:
>
> =====FAIL: stdio-common/tst-fseek.out=====
> 350: st_ctime not changed
> 355: st_mtime not changed
> 436: SEEK_END works
> 468: SEEK_END works
>
Maybe use TEST_TIMESPEC_EQUAL_OR_AFTER instead?
> ---
> stdio-common/tst-fseek.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/stdio-common/tst-fseek.c b/stdio-common/tst-fseek.c
> index 086ede5967..64f1e0a057 100644
> --- a/stdio-common/tst-fseek.c
> +++ b/stdio-common/tst-fseek.c
> @@ -345,12 +345,14 @@ do_test (void)
> printf ("%d: st_mtime not updated\n", __LINE__);
> result = 1;
> }
> - if (st1.st_ctime >= st2.st_ctime)
> + if (st1.st_ctime >= st2.st_ctime
> + && st1.st_ctim.tv_nsec == st2.st_ctim.tv_nsec)
> {
> printf ("%d: st_ctime not changed\n", __LINE__);
> result = 1;
> }
> - if (st1.st_mtime >= st2.st_mtime)
> + if (st1.st_mtime >= st2.st_mtime
> + && st1.st_mtim.tv_nsec == st2.st_mtim.tv_nsec)
> {
> printf ("%d: st_mtime not changed\n", __LINE__);
> result = 1;
>
> base-commit: 13c114c10bd3b665c1f11bd5f843bfe5e8238efb