[PATCH] tests: fix -nt test on low-resolution file systems

dana <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
in w/45470 i re-arranged the C02 '-N cond' test to fix an issue i was seeing on
apfs. i didn't realise that in doing so i broke the -nt test that follows it on
low-res file systems like hfs+. (i still use it for ram disks, and i happened to
try building on one)

this should make it work everywhere

dana


diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 3910f705f..2c43a65d8 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -143,7 +143,6 @@
 # can't be bothered with -S
 
   print -ru $ZTST_fd 'This test may take two seconds...'
-  touch $newnewnew
   if (( isnfs )); then
     ZTST_skip="[[ -N file ]] not supported with NFS"
   elif ! zmodload -F zsh/stat b:zstat 2> /dev/null; then
@@ -153,6 +152,9 @@
   elif [[ "$(zstat +atime $unmodified)" == "$(zstat +mtime $unmodified)" ]]; then
     ZTST_skip='[[ -N file ]] not supported on this file system'
   else
+    # note: on file systems with only 1s resolution, like hfs+, the -nt test
+    # below depends on this being touched after the sleep above
+    touch $newnewnew
     [[ -N $newnewnew && ! -N $unmodified ]]
   fi
 0:-N cond
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.