To: vim_dev@googlegroups.com Subject: Patch 8.1.0536 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0536 Problem: File time test fails when using NFS. Solution: Use three file times instead of localtim(). (James McCoy, closes #3618) Files: src/testdir/test_stat.vim *** ../vim-8.1.0535/src/testdir/test_stat.vim 2018-08-22 20:16:11.985125882 +0200 --- src/testdir/test_stat.vim 2018-11-18 12:19:41.877543229 +0100 *************** *** 1,31 **** " Tests for stat functions and checktime func CheckFileTime(doSleep) ! let fname = 'Xtest.tmp' let result = 0 ! let ts = localtime() ! if a:doSleep ! sleep 1 ! endif let fl = ['Hello World!'] ! call writefile(fl, fname) ! let tf = getftime(fname) ! if a:doSleep ! sleep 1 ! endif ! let te = localtime() ! let time_correct = (ts <= tf && tf <= te) if a:doSleep || time_correct ! call assert_true(time_correct) ! call assert_equal(strlen(fl[0] . "\n"), getfsize(fname)) ! call assert_equal('file', getftype(fname)) ! call assert_equal('rw-', getfperm(fname)[0:2]) let result = 1 endif ! call delete(fname) return result endfunc --- 1,33 ---- " Tests for stat functions and checktime func CheckFileTime(doSleep) ! let fnames = ['Xtest1.tmp', 'Xtest2.tmp', 'Xtest3.tmp'] ! let times = [] let result = 0 ! " Use three files istead of localtim(), with a network filesystem the file ! " times may differ at bit let fl = ['Hello World!'] ! for fname in fnames ! call writefile(fl, fname) ! call add(times, getftime(fname)) ! if a:doSleep ! sleep 1 ! endif ! endfor ! let time_correct = (times[0] <= times[1] && times[1] <= times[2]) if a:doSleep || time_correct ! call assert_true(time_correct, printf('Expected %s <= %s <= %s', times[0], times[1], times[2])) ! call assert_equal(strlen(fl[0] . "\n"), getfsize(fnames[0])) ! call assert_equal('file', getftype(fnames[0])) ! call assert_equal('rw-', getfperm(fnames[0])[0:2]) let result = 1 endif ! for fname in fnames ! call delete(fname) ! endfor return result endfunc *** ../vim-8.1.0535/src/version.c 2018-11-16 20:54:27.053554626 +0100 --- src/version.c 2018-11-18 12:23:05.864278755 +0100 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 536, /**/ -- Vi beats Emacs to death, and then again! http://linuxtoday.com/stories/5764.html /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///