From 69d1003bf79b7466d2fea45f94aeddbedd246049 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 01:55:19 +0300 Subject: [PATCH] functests: Fix some tests which are failing locally for unrelated reasons --- test/config/paths.lua.in | 3 ++- test/functional/api/server_requests_spec.lua | 4 +++- test/functional/eval/system_spec.lua | 4 +++- test/functional/ex_cmds/ctrl_c_spec.lua | 2 +- test/functional/helpers.lua | 7 ++++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/config/paths.lua.in b/test/config/paths.lua.in index 8dd4de75db..7fe5d8ad80 100644 --- a/test/config/paths.lua.in +++ b/test/config/paths.lua.in @@ -5,7 +5,8 @@ for p in ("${TEST_INCLUDE_DIRS}" .. ";"):gmatch("[^;]+") do table.insert(module.include_paths, p) end -module.test_include_path = "${CMAKE_BINARY_DIR}/test/includes/post" +module.test_build_dir = "${CMAKE_BINARY_DIR}" +module.test_include_path = module.test_build_dir .. "/test/includes/post" module.test_libnvim_path = "${TEST_LIBNVIM_PATH}" module.test_source_path = "${CMAKE_SOURCE_DIR}" module.test_lua_prg = "${LUA_PRG}" diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index 76a335a8f4..658077b112 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -1,6 +1,8 @@ -- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate -- `rpcrequest` calls we need the client event loop to be running. local helpers = require('test.functional.helpers')(after_each) +local Paths = require('test.config.paths') + local clear, nvim, eval = helpers.clear, helpers.nvim, helpers.eval local eq, neq, run, stop = helpers.eq, helpers.neq, helpers.run, helpers.stop local nvim_prog, command, funcs = helpers.nvim_prog, helpers.command, helpers.funcs @@ -200,7 +202,7 @@ describe('server -> client', function() \ 'rpc': v:true \ } ]]) - local lua_prog = arg[-1] + local lua_prog = Paths.test_lua_prg meths.set_var("args", {lua_prog, 'test/functional/api/rpc_fixture.lua'}) jobid = eval("jobstart(g:args, g:job_opts)") neq(0, 'jobid') diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua index 0b7d3dce21..bf95752e3b 100644 --- a/test/functional/eval/system_spec.lua +++ b/test/functional/eval/system_spec.lua @@ -1,4 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) + +local nvim_dir = helpers.nvim_dir local eq, call, clear, eval, feed_command, feed, nvim = helpers.eq, helpers.call, helpers.clear, helpers.eval, helpers.feed_command, helpers.feed, helpers.nvim @@ -31,7 +33,7 @@ describe('system()', function() describe('command passed as a List', function() local function printargs_path() - return helpers.nvim_dir..'/printargs-test' + return nvim_dir..'/printargs-test' .. (helpers.os_name() == 'windows' and '.exe' or '') end diff --git a/test/functional/ex_cmds/ctrl_c_spec.lua b/test/functional/ex_cmds/ctrl_c_spec.lua index 33affb26a5..993bfa0dba 100644 --- a/test/functional/ex_cmds/ctrl_c_spec.lua +++ b/test/functional/ex_cmds/ctrl_c_spec.lua @@ -47,7 +47,7 @@ describe("CTRL-C (mapped)", function() end -- The test is time-sensitive. Try different sleep values. - local ms_values = {1, 10, 100} + local ms_values = {1, 10, 100, 1000, 10000} for i, ms in ipairs(ms_values) do if i < #ms_values then local status, _ = pcall(test_ctrl_c, ms) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index adabfde9f7..13e6f36510 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -8,6 +8,7 @@ local Session = require('nvim.session') local TcpStream = require('nvim.tcp_stream') local SocketStream = require('nvim.socket_stream') local ChildProcessStream = require('nvim.child_process_stream') +local Paths = require('test.config.paths') local check_cores = global_helpers.check_cores local check_logs = global_helpers.check_logs @@ -20,7 +21,11 @@ local dedent = global_helpers.dedent local start_dir = lfs.currentdir() -- XXX: NVIM_PROG takes precedence, QuickBuild sets it. -local nvim_prog = os.getenv('NVIM_PROG') or os.getenv('NVIM_PRG') or 'build/bin/nvim' +local nvim_prog = ( + os.getenv('NVIM_PROG') + or os.getenv('NVIM_PRG') + or Paths.test_build_dir .. '/bin/nvim' +) -- Default settings for the test session. local nvim_set = 'set shortmess+=I background=light noswapfile noautoindent' ..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'