about summary refs log tree commit diff
path: root/Test/C02cond.ztst
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-05-02 17:31:18 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2016-05-02 17:31:18 -0700
commit4712b8f4d55149f2b44dd50214da145d57adf56a (patch)
tree207bd3c2a2d3ce20ca18998458afb56240c82ad2 /Test/C02cond.ztst
parent493c7e087981036ae2db67eb5b8e86db80b77917 (diff)
downloadzsh-4712b8f4d55149f2b44dd50214da145d57adf56a.tar.gz
zsh-4712b8f4d55149f2b44dd50214da145d57adf56a.tar.xz
zsh-4712b8f4d55149f2b44dd50214da145d57adf56a.zip
38375 (tweaked per 38384): try harder to detect noatime filesystems.
Diffstat (limited to 'Test/C02cond.ztst')
-rw-r--r--Test/C02cond.ztst22
1 files changed, 17 insertions, 5 deletions
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index f9fc185e9..b0e84ddeb 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -146,17 +146,29 @@
 
 # can't be bothered with -S
 
-  print -u $ZTST_fd 'This test takes two seconds...'
-  sleep 2
-  cat $unmodified
-  touch $newnewnew
+  if [[ ${mtab::="$({mount || /sbin/mount})"} = *[(]?*[)] ]]; then
+    print -u $ZTST_fd 'This test takes two seconds...'
+  else
+    unmodified_ls="$(ls -lu $unmodified)"
+    print -u $ZTST_fd 'This test takes up to 60 seconds...'
+  fi
   if [[ $OSTYPE == "cygwin" ]]; then
     ZTST_skip="[[ -N file ]] not supported on Cygwin"
   elif (( isnfs )); then
     ZTST_skip="[[ -N file ]] not supported with NFS"
-  elif { df -k -- ${$({mount || /sbin/mount} | awk '/noatime/ {print $1,$3}'):-""} | tr -s ' ' | fgrep -- "$(df -k . | tail -1 | tr -s ' ')" } >&/dev/null; then
+  elif { (( ! $+unmodified_ls )) &&
+         { sleep 2; cat $unmodified } &&
+         { df -k -- ${$(print -r -- "$mtab" |
+                        awk '/noatime/ {print $1,$3}'):-""} | tr -s ' ' |
+           fgrep -- "$(df -k . | tail -1 | tr -s ' ')" } >&/dev/null } ||
+       { (( $+unmodified_ls )) && SECONDS=0 &&
+         ! until (( SECONDS >= 60 )); do
+             ZTST_hashmark; sleep 2; cat $unmodified
+             [[ $unmodified_ls != "$(ls -lu $unmodified)" ]] && break
+	   done }; then
     ZTST_skip="[[ -N file ]] not supported with noatime file system"
   else
+    touch $newnewnew
     [[ -N $newnewnew && ! -N $unmodified ]]
   fi
 0:-N cond