neovim / neovim

Vim-fork focused on extensibility and usability
https://neovim.io
Other
83.3k stars 5.7k forks source link

[tests] Consistent failure for sign_spec.lua #2243

Closed ghost closed 9 years ago

ghost commented 9 years ago

git bisect says that this was introduced in 1ee7ca7bc0739526bf07ddc0cfc9fbbd18523591

233 successes / 0 failures / 1 error / 2 pending : 1.767078 seconds

Pending → /home/michael/src/neovim/test/functional/job/job_spec.lua @ 134
jobs will only emit the "exit" event after "stdout" and "stderr"

Pending → /home/michael/src/neovim/test/functional/job/job_spec.lua @ 189
jobs running tty-test program preprocessing ctrl+c with terminal driver

Error → ...michael/src/neovim/test/functional/ex_cmds/sign_spec.lua @ 9
sign unplace {id} without specifying buffer deletes the sign from all buffers
./test/functional/helpers.lua:53: attempt to index upvalue 'session' (a nil value)

stack traceback:
        ./test/functional/helpers.lua:53: in function 'nvim'
        ...michael/src/neovim/test/functional/ex_cmds/sign_spec.lua:11: in function <...michael/src/neovim/test/functional/ex_cmds/sign_spec.lua:9>

-- Output to stderr:

CMake Error at /home/michael/src/neovim/cmake/RunTests.cmake:39 (message):
  Running functional tests failed with error: 1.

Perhaps it's the version of lua I'm running?

tarruda commented 9 years ago

Does make distclean helps?

ghost commented 9 years ago

I ran make distclean between all bisects.

tarruda commented 9 years ago

It seems sign_spec.lua does not call clear in a before/setup hook, so the reported error will happen if its the first test. This patch should fix the problem:

diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua
index 74e1aa4..be213cd 100644
--- a/test/functional/ex_cmds/sign_spec.lua
+++ b/test/functional/ex_cmds/sign_spec.lua
@@ -4,6 +4,7 @@ local clear, nvim, buffer, curbuf, curwin, eq, ok =
   helpers.eq, helpers.ok

 describe('sign', function()
+  before_each(clear)
   describe('unplace {id}', function()
     describe('without specifying buffer', function()
       it('deletes the sign from all buffers', function()

Curiously, I cannot reproduce this on my local environment

justinmk commented 9 years ago

FWIW I also saw this issue, so thanks both.

ghost commented 9 years ago

Curiously, I cannot reproduce this on my local environment

Are you running on the latest master, not your builtin-terminal branch? I applied your patch to master, which is where I noticed the issue (which your patch fixed).

tarruda commented 9 years ago

I've been running tests on master and on the terminal branch. The error only happens if sign_spec.lua is the first test file ran(session is still nil), and I don't think the test execution order is deterministic.

ghost commented 9 years ago

I'm no longer getting the sign_spec.lua error, but my tests are failing with this:

https://gist.github.com/Pyrohh/77e9982785a2eef174ab

Already did make distclean and git clean -fdx if it makes a difference. I'll open an issue if needed.