1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0536
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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 ///
|