mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
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>
This commit is contained in:
@@ -69,15 +69,15 @@ do_test (void)
|
|||||||
TEST_VERIFY_EXIT (fd >= 0);
|
TEST_VERIFY_EXIT (fd >= 0);
|
||||||
support_write_file_string (path, "abc");
|
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;
|
struct statx stx;
|
||||||
TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
|
TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
|
||||||
|
|
||||||
test_t tests[] = { stat_check, lstat_check, fstat_check, fstatat_check };
|
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++)
|
for (int i = 0; i < array_length (tests); i++)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@@ -141,7 +141,8 @@ static __inline bool support_path_support_time64 (const char *path)
|
|||||||
0x80000002ULL);
|
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);
|
extern bool support_stat_nanoseconds (const char *path);
|
||||||
|
|
||||||
/* Return true if select modify the timeout to reflect the amount of time
|
/* Return true if select modify the timeout to reflect the amount of time
|
||||||
|
Reference in New Issue
Block a user