mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.1.0536: file time test fails when using NFS
Problem: File time test fails when using NFS. Solution: Use three file times instead of localtim(). (James McCoy, closes #3618)
This commit is contained in:
@@ -1,31 +1,33 @@
|
|||||||
" Tests for stat functions and checktime
|
" Tests for stat functions and checktime
|
||||||
|
|
||||||
func CheckFileTime(doSleep)
|
func CheckFileTime(doSleep)
|
||||||
let fname = 'Xtest.tmp'
|
let fnames = ['Xtest1.tmp', 'Xtest2.tmp', 'Xtest3.tmp']
|
||||||
|
let times = []
|
||||||
let result = 0
|
let result = 0
|
||||||
|
|
||||||
let ts = localtime()
|
" Use three files istead of localtim(), with a network filesystem the file
|
||||||
if a:doSleep
|
" times may differ at bit
|
||||||
sleep 1
|
|
||||||
endif
|
|
||||||
let fl = ['Hello World!']
|
let fl = ['Hello World!']
|
||||||
call writefile(fl, fname)
|
for fname in fnames
|
||||||
let tf = getftime(fname)
|
call writefile(fl, fname)
|
||||||
if a:doSleep
|
call add(times, getftime(fname))
|
||||||
sleep 1
|
if a:doSleep
|
||||||
endif
|
sleep 1
|
||||||
let te = localtime()
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
let time_correct = (ts <= tf && tf <= te)
|
let time_correct = (times[0] <= times[1] && times[1] <= times[2])
|
||||||
if a:doSleep || time_correct
|
if a:doSleep || time_correct
|
||||||
call assert_true(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(fname))
|
call assert_equal(strlen(fl[0] . "\n"), getfsize(fnames[0]))
|
||||||
call assert_equal('file', getftype(fname))
|
call assert_equal('file', getftype(fnames[0]))
|
||||||
call assert_equal('rw-', getfperm(fname)[0:2])
|
call assert_equal('rw-', getfperm(fnames[0])[0:2])
|
||||||
let result = 1
|
let result = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call delete(fname)
|
for fname in fnames
|
||||||
|
call delete(fname)
|
||||||
|
endfor
|
||||||
return result
|
return result
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -792,6 +792,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
536,
|
||||||
/**/
|
/**/
|
||||||
535,
|
535,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user