]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: port to noatime file systems
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Jul 2024 01:53:46 +0000 (18:53 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Jul 2024 01:54:20 +0000 (01:54 +0000)
On these file systems the atime is always zero.
Problem found with ZFS on Ubuntu 24.04 LTS.
* tests/stat/stat-birthtime.sh (check_timestamps_updated):
* tests/stat/stat-nanoseconds.sh:
Work even if atimes are always zero.
* tests/stat/stat-nanoseconds.sh:
Fix typo: print_ver_ called before init.sh sourced.

tests/stat/stat-birthtime.sh
tests/stat/stat-nanoseconds.sh

index 17a270e15b5d6899c54684f371cf5dcf51acb3f6..de39eaed939bb4af01b31ef08abb91d4bcecdc82 100755 (executable)
@@ -42,7 +42,7 @@ check_timestamps_updated()
   touch a || fail=1
 
   test "x$btime" = x$(stat --format %W a) &&
-  test "x$atime" != x$(stat --format %X a) &&
+  { test "x$atime" != x$(stat --format %X a) || test "x$atime" = x0; } &&
   test "x$mtime" != x$(stat --format %Y a) &&
   test "x$ctime" != x$(stat --format %Z a)
 }
index 7ee8264b014bf5eb5aae0a5580d939772f0157d0..a4f55cf6d0f046379346baf6f8849df2b93c42d7 100755 (executable)
@@ -16,8 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-print_ver_ stat
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ stat
 
 # Set this to avoid problems with weird time zones.
 TZ=UTC0
@@ -29,18 +29,18 @@ touch -d '1970-01-01 18:43:33.023456789' k || framework_failure_
 ls --full-time | grep 18:43:33.023456789 \
   || skip_ this file system does not support sub-second timestamps
 
-test "$(stat -c       %X k)" =    67413               || fail=1
-test "$(stat -c      %.X k)" =    67413.023456789     || fail=1
-test "$(stat -c     %.1X k)" =    67413.0             || fail=1
-test "$(stat -c     %.3X k)" =    67413.023           || fail=1
-test "$(stat -c     %.6X k)" =    67413.023456        || fail=1
-test "$(stat -c     %.9X k)" =    67413.023456789     || fail=1
-test "$(stat -c   %13.6X k)" =  ' 67413.023456'       || fail=1
-test "$(stat -c  %013.6X k)" =   067413.023456        || fail=1
-test "$(stat -c  %-13.6X k)" =   '67413.023456 '      || fail=1
-test "$(stat -c  %18.10X k)" = '  67413.0234567890'   || fail=1
-test "$(stat -c %I18.10X k)" = '  67413.0234567890'   || fail=1
-test "$(stat -c %018.10X k)" =  0067413.0234567890    || fail=1
-test "$(stat -c %-18.10X k)" =   '67413.0234567890  ' || fail=1
+test "$(stat -c       %Y k)" =    67413               || fail=1
+test "$(stat -c      %.Y k)" =    67413.023456789     || fail=1
+test "$(stat -c     %.1Y k)" =    67413.0             || fail=1
+test "$(stat -c     %.3Y k)" =    67413.023           || fail=1
+test "$(stat -c     %.6Y k)" =    67413.023456        || fail=1
+test "$(stat -c     %.9Y k)" =    67413.023456789     || fail=1
+test "$(stat -c   %13.6Y k)" =  ' 67413.023456'       || fail=1
+test "$(stat -c  %013.6Y k)" =   067413.023456        || fail=1
+test "$(stat -c  %-13.6Y k)" =   '67413.023456 '      || fail=1
+test "$(stat -c  %18.10Y k)" = '  67413.0234567890'   || fail=1
+test "$(stat -c %I18.10Y k)" = '  67413.0234567890'   || fail=1
+test "$(stat -c %018.10Y k)" =  0067413.0234567890    || fail=1
+test "$(stat -c %-18.10Y k)" =   '67413.0234567890  ' || fail=1
 
 Exit $fail