Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in C02cont.ztst's -N test



On 2016/05/01, at 3:11, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
(snip)
> 
> -  sleep 2
> -  cat $unmodified
> -  touch $newnewnew
(snip)
> +  elif { (( ! $+unmodified_ls )) &&
> +         { sleep 2; cat $unmodified } &&
(snip)
> 
>   else
> +    touch $newnewnew

Moving 'touch $newnewnew' into the 'else' block causes a problem
on a system where the test for -N is skipped, for example Cygwin.
The file newnewnew is not created at all, and the next test
  [[ $newnewnew -nt $zlnfs && ! ($unmodified -nt $zlnfs) ]] 
fails.

diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index b0e84dd..63c89dd 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -152,12 +152,14 @@
     unmodified_ls="$(ls -lu $unmodified)"
     print -u $ZTST_fd 'This test takes up to 60 seconds...'
   fi
+  sleep 2
+  touch $newnewnew
   if [[ $OSTYPE == "cygwin" ]]; then
     ZTST_skip="[[ -N file ]] not supported on Cygwin"
   elif (( isnfs )); then
     ZTST_skip="[[ -N file ]] not supported with NFS"
   elif { (( ! $+unmodified_ls )) &&
-         { sleep 2; cat $unmodified } &&
+         cat $unmodified &&
          { df -k -- ${$(print -r -- "$mtab" |
                         awk '/noatime/ {print $1,$3}'):-""} | tr -s ' ' |
            fgrep -- "$(df -k . | tail -1 | tr -s ' ')" } >&/dev/null } ||
@@ -168,7 +170,6 @@
 	   done }; then
     ZTST_skip="[[ -N file ]] not supported with noatime file system"
   else
-    touch $newnewnew
     [[ -N $newnewnew && ! -N $unmodified ]]
   fi
 0:-N cond





Messages sorted by: Reverse Date, Date, Thread, Author