diff options
author | dundargoc <gocdundar@gmail.com> | 2023-09-24 21:19:01 +0200 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-04-02 17:07:44 +0200 |
commit | ffe3002568f849df1b155b90d6ea0e1f48d8c6d5 (patch) | |
tree | 8b4732fcbc9b9902f04b1c2b990f2cc7b2ac20a4 | |
parent | 6cfca21bac6bb39b50cba1c23ffb2b69e2d94df8 (diff) | |
download | rneovim-ffe3002568f849df1b155b90d6ea0e1f48d8c6d5.tar.gz rneovim-ffe3002568f849df1b155b90d6ea0e1f48d8c6d5.tar.bz2 rneovim-ffe3002568f849df1b155b90d6ea0e1f48d8c6d5.zip |
test: silence expected errors
This will remove unrelated errors in .nvimlog at the end of test output.
-rw-r--r-- | src/nvim/decoration_provider.c | 2 | ||||
-rw-r--r-- | src/nvim/event/libuv_process.c | 2 | ||||
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 2 | ||||
-rw-r--r-- | test/functional/autocmd/autocmd_oldtest_spec.lua | 13 | ||||
-rw-r--r-- | test/functional/core/startup_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/options/defaults_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/ui/embed_spec.lua | 14 |
8 files changed, 66 insertions, 6 deletions
diff --git a/src/nvim/decoration_provider.c b/src/nvim/decoration_provider.c index 2417c14f7f..74f444d8e8 100644 --- a/src/nvim/decoration_provider.c +++ b/src/nvim/decoration_provider.c @@ -35,7 +35,7 @@ static kvec_t(DecorProvider) decor_providers = KV_INITIAL_VALUE; static void decor_provider_error(DecorProvider *provider, const char *name, const char *msg) { const char *ns_name = describe_ns(provider->ns_id, "(UNKNOWN PLUGIN)"); - ELOG("error in provider %s.%s: %s", ns_name, name, msg); + ILOG("error in provider %s.%s: %s", ns_name, name, msg); msg_schedule_semsg_multiline("Error in decoration provider %s.%s:\n%s", ns_name, name, msg); } diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index a7966994e0..608aeb4c15 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -90,7 +90,7 @@ int libuv_process_spawn(LibuvProcess *uvproc) int status; if ((status = uv_spawn(&proc->loop->uv, &uvproc->uv, &uvproc->uvopts))) { - ELOG("uv_spawn(%s) failed: %s", uvproc->uvopts.file, uv_strerror(status)); + DLOG("uv_spawn(%s) failed: %s", uvproc->uvopts.file, uv_strerror(status)); if (uvproc->uvopts.env) { os_free_fullenv(uvproc->uvopts.env); } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index a8fde5a652..6921deae7e 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -339,7 +339,7 @@ static void parse_msgpack(Channel *channel) } if (unpacker_closed(p)) { - chan_close_with_error(channel, p->unpack_error.msg, LOGLVL_ERR); + chan_close_with_error(channel, p->unpack_error.msg, LOGLVL_INF); api_clear_error(&p->unpack_error); } } diff --git a/test/functional/autocmd/autocmd_oldtest_spec.lua b/test/functional/autocmd/autocmd_oldtest_spec.lua index 0243674f2d..279eb495e7 100644 --- a/test/functional/autocmd/autocmd_oldtest_spec.lua +++ b/test/functional/autocmd/autocmd_oldtest_spec.lua @@ -7,10 +7,18 @@ local api = helpers.api local fn = helpers.fn local exec = helpers.exec local feed = helpers.feed +local assert_log = helpers.assert_log +local is_os = helpers.is_os + +local testlog = 'Xtest_autocmd_oldtest_log' describe('oldtests', function() before_each(clear) + after_each(function() + os.remove(testlog) + end) + local exec_lines = function(str) return fn.split(fn.execute(str), '\n') end @@ -49,6 +57,7 @@ describe('oldtests', function() end) it('should fire on unload buf', function() + clear({ env = { NVIM_LOG_FILE = testlog } }) fn.writefile({ 'Test file Xxx1' }, 'Xxx1') fn.writefile({ 'Test file Xxx2' }, 'Xxx2') local fname = 'Xtest_functional_autocmd_unload' @@ -81,6 +90,10 @@ describe('oldtests', function() fn.delete('Xxx2') fn.delete(fname) fn.delete('Xout') + + if is_os('win') then + assert_log('stream write failed. RPC canceled; closing channel', testlog) + end end) -- oldtest: Test_delete_ml_get_errors() diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 2e6649d16a..adf29cbe7c 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -33,6 +33,8 @@ local tbl_map = vim.tbl_map local tbl_filter = vim.tbl_filter local endswith = vim.endswith +local testlog = 'Xtest-startupspec-log' + describe('startup', function() it('--clean', function() clear() @@ -121,6 +123,10 @@ end) describe('startup', function() before_each(clear) + after_each(function() + os.remove(testlog) + end) + describe('-l Lua', function() local function assert_l_out(expected, nvim_args, lua_args, script, input) local args = { nvim_prog } @@ -371,6 +377,7 @@ describe('startup', function() end) it('output to pipe: has("ttyin")==1 has("ttyout")==0', function() + clear({ env = { NVIM_LOG_FILE = testlog } }) if is_os('win') then command([[set shellcmdflag=/s\ /c shellxquote=\"]]) end @@ -398,9 +405,13 @@ describe('startup', function() read_file('Xtest_startup_ttyout') ) end) + if is_os('win') then + assert_log('stream write failed. RPC canceled; closing channel', testlog) + end end) it('input from pipe: has("ttyin")==0 has("ttyout")==1', function() + clear({ env = { NVIM_LOG_FILE = testlog } }) if is_os('win') then command([[set shellcmdflag=/s\ /c shellxquote=\"]]) end @@ -429,9 +440,13 @@ describe('startup', function() read_file('Xtest_startup_ttyout') ) end) + if is_os('win') then + assert_log('stream write failed. RPC canceled; closing channel', testlog) + end end) it('input from pipe (implicit) #7679', function() + clear({ env = { NVIM_LOG_FILE = testlog } }) local screen = Screen.new(25, 4) screen:attach() screen._default_attr_ids = nil @@ -457,6 +472,9 @@ describe('startup', function() 0 1 | | ]]) + if not is_os('win') then + assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog) + end end) it('input from pipe + file args #7679', function() diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index 70000f52d2..2d3d827619 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -865,6 +865,10 @@ describe('XDG defaults', function() end) describe('stdpath()', function() + after_each(function() + os.remove(testlog) + end) + -- Windows appends 'nvim-data' instead of just 'nvim' to prevent collisions -- due to XDG_CONFIG_HOME, XDG_DATA_HOME and XDG_STATE_HOME being the same. local function maybe_data(name) @@ -890,7 +894,7 @@ describe('stdpath()', function() it('reacts to $NVIM_APPNAME', function() local appname = 'NVIM_APPNAME_TEST' .. ('_'):rep(106) - clear({ env = { NVIM_APPNAME = appname } }) + clear({ env = { NVIM_APPNAME = appname, NVIM_LOG_FILE = testlog } }) eq(appname, fn.fnamemodify(fn.stdpath('config'), ':t')) eq(appname, fn.fnamemodify(fn.stdpath('cache'), ':t')) eq(maybe_data(appname), fn.fnamemodify(fn.stdpath('log'), ':t')) @@ -928,6 +932,9 @@ describe('stdpath()', function() -- Valid appnames: test_appname('a/b', 0) test_appname('a/b\\c', 0) + if not is_os('win') then + assert_log('Failed to start server: no such file or directory:', testlog) + end end) describe('returns a String', function() diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 10d9099431..007ae25b33 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -29,6 +29,9 @@ local spawn_argv = helpers.spawn_argv local set_session = helpers.set_session local write_file = helpers.write_file local eval = helpers.eval +local assert_log = helpers.assert_log + +local testlog = 'Xtest-tui-log' if helpers.skip(is_os('win')) then return @@ -3000,6 +3003,10 @@ end) -- These tests require `thelpers` because --headless/--embed -- does not initialize the TUI. describe('TUI as a client', function() + after_each(function() + os.remove(testlog) + end) + it('connects to remote instance (with its own TUI)', function() local server_super = spawn_argv(false) -- equivalent to clear() local client_super = spawn_argv(true) @@ -3077,7 +3084,7 @@ describe('TUI as a client', function() it('connects to remote instance (--headless)', function() local server = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true) + local client_super = spawn_argv(true, { env = { NVIM_LOG_FILE = testlog } }) set_session(server) local server_pipe = api.nvim_get_vvar('servername') @@ -3120,6 +3127,9 @@ describe('TUI as a client', function() client_super:close() server:close() + if is_os('mac') then + assert_log('uv_tty_set_mode failed: Unknown system error %-102', testlog) + end end) it('throws error when no server exists', function() diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index 0445476780..77eae3627d 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -13,6 +13,10 @@ local fn = helpers.fn local nvim_prog = helpers.nvim_prog local retry = helpers.retry local write_file = helpers.write_file +local assert_log = helpers.assert_log +local is_os = helpers.is_os + +local testlog = 'Xtest-embed-log' local function test_embed(ext_linegrid) local screen @@ -93,13 +97,17 @@ describe('--embed UI on startup (ext_linegrid=false)', function() end) describe('--embed UI', function() + after_each(function() + os.remove(testlog) + end) + it('can pass stdin', function() local pipe = assert(uv.pipe()) local writer = assert(uv.new_pipe(false)) writer:open(pipe.write) - clear { args_rm = { '--headless' }, io_extra = pipe.read } + clear { args_rm = { '--headless' }, io_extra = pipe.read, env = { NVIM_LOG_FILE = testlog } } -- attach immediately after startup, for early UI local screen = Screen.new(40, 8) @@ -131,6 +139,10 @@ describe('--embed UI', function() {1:~ }|*4 {2:-- INSERT --} | ]] + + if not is_os('win') then + assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog) + end end) it('can pass stdin to -q - #17523', function() |