aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/fileio_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-12-05 12:52:06 -0800
committerGitHub <noreply@github.com>2023-12-05 12:52:06 -0800
commit27501d3b6a8d577cf3f5ecc3fe9e219f477586b7 (patch)
tree8622096da73218b6c05ab5559f3516272033b5c1 /test/functional/core/fileio_spec.lua
parentca4fe083e5b1a7c2e93cf77aa849fbec72757627 (diff)
downloadrneovim-27501d3b6a8d577cf3f5ecc3fe9e219f477586b7.tar.gz
rneovim-27501d3b6a8d577cf3f5ecc3fe9e219f477586b7.tar.bz2
rneovim-27501d3b6a8d577cf3f5ecc3fe9e219f477586b7.zip
test: fileio_spec is unreliable/flaky #26404
Problem: CI sometimes fails. Something is triggering an extra fsync(). FAILED test/functional/core/fileio_spec.lua @ 52: fileio fsync() codepaths #8304 test/functional/core/fileio_spec.lua:87: Expected objects to be the same. Passed in: (number) 3 Expected: (number) 2 stack traceback: test/functional/core/fileio_spec.lua:87: in function <test/functional/core/fileio_spec.lua:52> Solution: Relax the assertion to `fsync >= 2` instead of exactly 2. (Note this is not a behavior change: the next assertion has always checked `fsync == 4`, it's just that the intermediate 3rd fsync was never explicitly asserted.)
Diffstat (limited to 'test/functional/core/fileio_spec.lua')
-rw-r--r--test/functional/core/fileio_spec.lua44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua
index 65f947132e..c347b51dd3 100644
--- a/test/functional/core/fileio_spec.lua
+++ b/test/functional/core/fileio_spec.lua
@@ -49,48 +49,48 @@ describe('fileio', function()
rmdir('Xtest_backupdir with spaces')
end)
- it('fsync() codepaths #8304', function()
- clear({ args={ '-i', 'Xtest_startup_shada',
- '--cmd', 'set nofsync',
- '--cmd', 'set directory=Xtest_startup_swapdir' } })
+ it("fsync() with 'nofsync' #8304", function()
+ clear({ args={ '--cmd', 'set nofsync directory=Xtest_startup_swapdir', } })
-- These cases ALWAYS force fsync (regardless of 'fsync' option):
-- 1. Idle (CursorHold) with modified buffers (+ 'swapfile').
command('write Xtest_startup_file1')
- feed('ifoo<esc>h')
+ feed('Afoo<esc>h')
command('write')
- eq(0, request('nvim__stats').fsync) -- 'nofsync' is the default.
+ eq(0, request('nvim__stats').fsync)
command('set swapfile')
command('set updatetime=1')
- feed('izub<esc>h') -- File is 'modified'.
+ feed('Azub<esc>h') -- File is 'modified'.
sleep(3) -- Allow 'updatetime' to expire.
retry(3, nil, function()
eq(1, request('nvim__stats').fsync)
end)
- command('set updatetime=9999')
+ command('set updatetime=100000 updatecount=100000')
+
+ -- 2. Explicit :preserve command.
+ command('preserve')
+ -- TODO: should be exactly 2; figure out where the extra fsync() is coming from. #26404
+ ok(request('nvim__stats').fsync >= 2)
+
+ -- 3. Enable 'fsync' option, write file.
+ command('set fsync')
+ feed('Abaz<esc>h')
+ command('write')
+ eq(4, request('nvim__stats').fsync)
+ eq('foozubbaz', trim(read_file('Xtest_startup_file1')))
- -- 2. Exit caused by deadly signal (+ 'swapfile').
- local j = funcs.jobstart({ nvim_prog, '-u', 'NONE', '-i',
- 'Xtest_startup_shada', '--headless',
+ -- 4. Exit caused by deadly signal (+ 'swapfile').
+ local j = funcs.jobstart({ nvim_prog, '-u', 'NONE', '--headless',
+ '--cmd', 'set nofsync directory=Xtest_startup_swapdir',
'-c', 'set swapfile',
'-c', 'write Xtest_startup_file2',
'-c', 'put =localtime()', })
sleep(10) -- Let Nvim start.
funcs.jobstop(j) -- Send deadly signal.
- -- 3. SIGPWR signal.
+ -- 5. SIGPWR signal.
-- ??
-
- -- 4. Explicit :preserve command.
- command('preserve')
- eq(2, request('nvim__stats').fsync)
-
- -- 5. Enable 'fsync' option, write file.
- command('set fsync')
- feed('ibaz<esc>h')
- command('write')
- eq(4, request('nvim__stats').fsync)
end)
it('backup #9709', function()