diff options
author | John Szakmeister <john@szakmeister.net> | 2015-03-01 14:49:48 -0500 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2015-03-01 15:25:39 -0500 |
commit | d8ef23849af0e57a35a87d477a468a9241f78ad8 (patch) | |
tree | 2cfb5e66fa62662e6ea6f3aac719ebad56928b16 | |
parent | ea35062589142459ca657f3977d76636bf9bd29d (diff) | |
download | rneovim-d8ef23849af0e57a35a87d477a468a9241f78ad8.tar.gz rneovim-d8ef23849af0e57a35a87d477a468a9241f78ad8.tar.bz2 rneovim-d8ef23849af0e57a35a87d477a468a9241f78ad8.zip |
tests: prevent busted from reloading the ffi module and others
It turns out that Busted started cleaning the environment in 2.0rc5 as a
result of Olivine-Labs/busted#62. This, in turn, caused the ffi module
to be reloaded for each spec file, and LuaJIT doesn't appreciate it.
The net effect is an assertion error in LuaJIT.
By using the --helper feature of Busted, we can pre-load some modules
ahead of Busted and prevent it from reloading them--making LuaJIT happy
again.
-rw-r--r-- | cmake/RunTests.cmake | 1 | ||||
-rw-r--r-- | test/functional/preload.lua | 5 | ||||
-rw-r--r-- | test/unit/preload.lua | 7 |
3 files changed, 13 insertions, 0 deletions
diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 8f303bae2e..a4330a58de 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -15,6 +15,7 @@ endif() execute_process( COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE} + --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua ${TEST_PATH} WORKING_DIRECTORY ${WORKING_DIR} ERROR_VARIABLE err diff --git a/test/functional/preload.lua b/test/functional/preload.lua new file mode 100644 index 0000000000..5f34f7fa6e --- /dev/null +++ b/test/functional/preload.lua @@ -0,0 +1,5 @@ +-- Modules loaded here will not be cleared and reloaded by Busted. +-- Busted started doing this to help provide more isolation. See issue #62 +-- for more information about this. +local ffi = require('ffi') +local helpers = require('test.functional.helpers') diff --git a/test/unit/preload.lua b/test/unit/preload.lua new file mode 100644 index 0000000000..d8ec2c3943 --- /dev/null +++ b/test/unit/preload.lua @@ -0,0 +1,7 @@ +-- Modules loaded here will not be cleared and reloaded by Busted. +-- Busted started doing this to help provide more isolation. See issue #62 +-- for more information about this. +local ffi = require('ffi') +local helpers = require('test.unit.helpers') +local lfs = require('lfs') +local preprocess = require('test.unit.preprocess') |