From e85c9966b8b5011e8eda1aef20d00d74d6eec581 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 7 Jul 2015 22:58:32 -0300 Subject: test: Increase determinism in screen_basic_spec tests --- test/functional/ui/screen.lua | 7 +++++++ test/functional/ui/screen_basic_spec.lua | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 9635f6119c..60198bb008 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -259,6 +259,13 @@ This is probably due to an indeterminism in the test. Try adding `wait()` (or even a separate `screen:expect(...)`) at a point of possible indeterminism, typically in between a `feed()` or `execute()` which is non- synchronous, and a synchronous api call. + +Note that sometimes a `wait` can trigger redraws and consequently generate more +indeterminism. If adding `wait` calls seems to increase the frequency of these +messages, try removing every `wait` call in the test. + +If everything else fails, use Screen:redraw_debug to help investigate what is + causing the problem. ]]) local tb = debug.traceback() local index = string.find(tb, '\n%s*%[C]') diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index d57c1773b1..472c211ab7 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -488,7 +488,6 @@ describe('Screen', function() end) it('has minimum width/height values', function() - wait() screen:try_resize(1, 1) screen:expect([[ -- INS^ERT --| -- cgit From 9e42ef4e1312fb6888d2691e9d979b95dd43ec94 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 16 Jul 2015 13:30:45 -0300 Subject: test: lower sleep value in job test Since sleep is a grandchild of nvim, it is not killed after the test ends. Using a low sleep value allows it to exit automatically after a small interval. --- test/functional/job/job_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua index b60f9ff7a4..7085d61cc7 100644 --- a/test/functional/job/job_spec.lua +++ b/test/functional/job/job_spec.lua @@ -304,7 +304,7 @@ describe('jobs', function() source([[ call rpcnotify(g:channel, 'wait', jobwait([ \ jobstart([&sh, '-c', 'exit 4']), - \ jobstart([&sh, '-c', 'sleep 10000; exit 5']), + \ jobstart([&sh, '-c', 'sleep 10; exit 5']), \ ], 100)) ]]) eq({'notification', 'wait', {{4, -1}}}, next_msg()) -- cgit From 991d3ec1e679bb6407f2a5820910d2968424183c Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 16 Jul 2015 23:10:04 -0300 Subject: event loop: New abstraction layer with refactored time/signal API - Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts. --- test/unit/os/fs_spec.lua | 2 +- test/unit/os/shell_spec.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 3d5c6bc885..2ffffb907f 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -19,7 +19,7 @@ require('bit') cimport('unistd.h') cimport('./src/nvim/os/shell.h') cimport('./src/nvim/option_defs.h') -cimport('./src/nvim/os/event.h') +cimport('./src/nvim/main.h') cimport('./src/nvim/fileio.h') local fs = cimport('./src/nvim/os/os.h') cppimport('sys/stat.h') diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua index 91d807da0b..91123bfd58 100644 --- a/test/unit/os/shell_spec.lua +++ b/test/unit/os/shell_spec.lua @@ -14,7 +14,7 @@ local helpers = require('test.unit.helpers') local shell = helpers.cimport( './src/nvim/os/shell.h', './src/nvim/option_defs.h', - './src/nvim/os/event.h', + './src/nvim/main.h', './src/nvim/misc1.h' ) local ffi, eq, neq = helpers.ffi, helpers.eq, helpers.neq -- cgit