2 # ensure that stat attempts birthtime access
4 # Copyright (C) 2010-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
22 # Whether birthtime is supported or not, it better not change even when
23 # [acm]time are modified. :)
25 btime
=$
(stat
--format %W a
) || fail
=1
26 atime
=$
(stat
--format %X a
) || fail
=1
27 mtime
=$
(stat
--format %Y a
) || fail
=1
28 ctime
=$
(stat
--format %Z a
) || fail
=1
30 # Wait up to 2.17s for timestamps to change.
31 # ----------------------------------------
32 # iterations file system resolution e.g.
33 # ----------------------------------------
34 # 1 nano or micro second ext4
37 # ----------------------------------------
38 check_timestamps_updated
()
44 test "x$btime" = x$
(stat
--format %W a
) &&
45 { test "x$atime" != x$
(stat
--format %X a
) ||
test "x$atime" = x0
; } &&
46 test "x$mtime" != x$
(stat
--format %Y a
) &&
47 test "x$ctime" != x$
(stat
--format %Z a
)
49 retry_delay_ check_timestamps_updated
.07 5 || fail
=1