From 03348e5b9db3f057057a70581ef71180c3cb6527 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 13 Feb 2022 21:33:28 +0800 Subject: vim-patch:8.2.3510: changes are only detected with one second accuracy Problem: Changes are only detected with one second accuracy. Solution: Use the nanosecond time if possible. (Leah Neukirchen, closes vim/vim#8873, closes vim/vim#8875) https://github.com/vim/vim/commit/0a7984af5601323fae7b3398f05a48087db7b767 In Nvim Test_checktime_fast() is also flaky. Add a delay to avoid that. --- src/nvim/testdir/test_stat.vim | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index 170358e023..a6fe31b85a 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -1,5 +1,7 @@ " Tests for stat functions and checktime +source check.vim + func CheckFileTime(doSleep) let fnames = ['Xtest1.tmp', 'Xtest2.tmp', 'Xtest3.tmp'] let times = [] @@ -74,6 +76,40 @@ func Test_checktime() call delete(fname) endfunc +func Test_checktime_fast() + CheckFeature nanotime + + let fname = 'Xtest.tmp' + + let fl = ['Hello World!'] + call writefile(fl, fname) + set autoread + exec 'e' fname + let fl = readfile(fname) + let fl[0] .= ' - checktime' + sleep 10m " make test less flaky in Nvim + call writefile(fl, fname) + checktime + call assert_equal(fl[0], getline(1)) + + call delete(fname) +endfunc + +func Test_autoread_fast() + CheckFeature nanotime + + new Xautoread + set autoread + call setline(1, 'foo') + + w! + silent !echo bar > Xautoread + checktime + + call assert_equal('bar', trim(getline(1))) + call delete('Xautoread') +endfunc + func Test_autoread_file_deleted() new Xautoread set autoread -- cgit From bad22bd65668bb0677be35759a793e60543df980 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 13 Feb 2022 21:33:28 +0800 Subject: vim-patch:8.2.3512: timestamp test fails on some systems Problem: Timestamp test fails on some systems. Solution: Sleep for a short while. https://github.com/vim/vim/commit/accf4ed352c07ffe59022377c42d36e12dd6d461 --- src/nvim/testdir/test_stat.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index a6fe31b85a..841b5d2db7 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -104,6 +104,7 @@ func Test_autoread_fast() w! silent !echo bar > Xautoread + sleep 10m checktime call assert_equal('bar', trim(getline(1))) -- cgit From 21283aa445a0b2e13f1c6ac56512165c5bc17922 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 13 Feb 2022 21:33:28 +0800 Subject: vim-patch:8.2.3514: autoread test with nano second time sometimes fails Problem: Autoread test with nano second time sometimes fails. Solution: Mark the test as being flaky. https://github.com/vim/vim/commit/eaa006dae3d5730e3b6dead27905444998b2cf8e --- src/nvim/testdir/test_stat.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index 841b5d2db7..893a740ee2 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -98,16 +98,18 @@ endfunc func Test_autoread_fast() CheckFeature nanotime + " this is timing sensitive + let g:test_is_flaky = 1 + new Xautoread - set autoread + setlocal autoread call setline(1, 'foo') - w! silent !echo bar > Xautoread sleep 10m checktime - call assert_equal('bar', trim(getline(1))) + call delete('Xautoread') endfunc -- cgit From b2606673cc367c018527203fbc7c3e85cc9a4e8e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 13 Feb 2022 21:33:28 +0800 Subject: vim-patch:8.2.3534: autoread test is a bit flaky Problem: Autoread test is a bit flaky. Solution: Wait a brief moment before overwriting the file. https://github.com/vim/vim/commit/944eeb44fb6e9d6d28474a1348d27c07873892f9 --- src/nvim/testdir/test_stat.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index 893a740ee2..b44f3e9b94 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -105,7 +105,8 @@ func Test_autoread_fast() setlocal autoread call setline(1, 'foo') w! - silent !echo bar > Xautoread + sleep 10m + call writefile(['bar'], 'Xautoread') sleep 10m checktime call assert_equal('bar', trim(getline(1))) -- cgit