From fa0c677a63079e5d27ff037ea8f1e23a71fe6680 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 9 Aug 2019 15:32:38 +0200 Subject: tests/functional: expect_msg_seq: use load_adjust (#10727) Regardless of the comment "Big timeout for ASAN/valgrind" it would use 10s by default already. This changes it to use `load_adjust`, which itself is only computed on CI now, and outside of any tests - since it has side effects when being used the first time! The failure seen on AppVeyor: [ RUN ] jobs can get the pid value using getpid: ERR test\functional\helpers.lua:167: ============================================================================== got 0 messages (ignored 0), expected 1 stack traceback: test\functional\helpers.lua:167: in function 'expect_msg_seq' test/functional\core\job_spec.lua:288: in function Log: https://ci.appveyor.com/project/neovim/neovim/builds/26537324/job/y1io66fbx399q7h6?fullLog=true#L6554 --- test/functional/helpers.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 4dde733e1e..d4ace3030c 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -165,11 +165,12 @@ function module.expect_msg_seq(...) end return string.format('%s\n%s\n%s', err1, string.rep('=', 78), err2) end + local msg_timeout = module.load_adjust(10000) -- Big timeout for ASAN/valgrind. for anum = 1, #seqs do local expected_seq = seqs[anum] -- Collect enough messages to compare the next expected sequence. while #actual_seq < #expected_seq do - local msg = module.next_msg(10000) -- Big timeout for ASAN/valgrind. + local msg = module.next_msg(msg_timeout) local msg_type = msg and msg[2] or nil if msg == nil then error(cat_err(final_error, @@ -770,14 +771,14 @@ function module.alter_slashes(obj) end end - -local load_factor = nil +local load_factor = 1 +if global_helpers.isCI() then + -- Compute load factor only once (but outside of any tests). + module.clear() + module.request('nvim_command', 'source src/nvim/testdir/load.vim') + load_factor = module.request('nvim_eval', 'g:test_load_factor') +end function module.load_adjust(num) - if load_factor == nil then -- Compute load factor only once. - module.clear() - module.request('nvim_command', 'source src/nvim/testdir/load.vim') - load_factor = module.request('nvim_eval', 'g:test_load_factor') - end return math.ceil(num * load_factor) end -- cgit