diff options
author | John Szakmeister <john@szakmeister.net> | 2014-04-30 05:10:37 -0400 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2014-05-03 10:36:54 -0400 |
commit | 7cb20fd1b09a5c263ca3aef57d87f09084fb7830 (patch) | |
tree | fd3a9c86ba823cd969b3a65c6d94b55f2d87d6ee /test | |
parent | 4fe0a51844cc7502e46d29b8ac4077d76eba41c0 (diff) | |
download | rneovim-7cb20fd1b09a5c263ca3aef57d87f09084fb7830.tar.gz rneovim-7cb20fd1b09a5c263ca3aef57d87f09084fb7830.tar.bz2 rneovim-7cb20fd1b09a5c263ca3aef57d87f09084fb7830.zip |
Generate a lua module to help pass build-related settings.
This allows us to avoid hard-coding paths and using environment
variables to communicate key information to unit tests, which fits
with the overall goal of making sure that folks driving CMake directly
can continue to do out-of-tree builds.
Diffstat (limited to 'test')
-rw-r--r-- | test/config/paths.lua.in | 11 | ||||
-rw-r--r-- | test/unit/helpers.moon | 24 |
2 files changed, 16 insertions, 19 deletions
diff --git a/test/config/paths.lua.in b/test/config/paths.lua.in new file mode 100644 index 0000000000..9ec8b23055 --- /dev/null +++ b/test/config/paths.lua.in @@ -0,0 +1,11 @@ +local module = {} + +module.include_paths = {} +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_libnvim_path = "${TEST_LIBNVIM_PATH}" + +return module diff --git a/test/unit/helpers.moon b/test/unit/helpers.moon index e84c569143..8acbe8f992 100644 --- a/test/unit/helpers.moon +++ b/test/unit/helpers.moon @@ -3,24 +3,14 @@ lpeg = require 'lpeg' formatc = require 'test.unit.formatc' Set = require 'test.unit.set' Preprocess = require 'test.unit.preprocess' +Paths = require 'test.config.paths' -- add some standard header locations --- TODO(aktau, jszakmeister): optionally pass more header locations via env -Preprocess.add_to_include_path('./src') -Preprocess.add_to_include_path('./.deps/usr/include') -Preprocess.add_to_include_path('./build/config') - -if ffi.abi('32bit') - Preprocess.add_to_include_path('/opt/neovim-deps/32/include') -else - Preprocess.add_to_include_path('/opt/neovim-deps/include') +for i,p in ipairs(Paths.include_paths) + Preprocess.add_to_include_path(p) -- load neovim shared library -testlib = os.getenv 'NVIM_TEST_LIB' -unless testlib - testlib = './build/src/libnvim-test.so' - -libnvim = ffi.load testlib +libnvim = ffi.load Paths.test_libnvim_path trim = (s) -> s\match'^%s*(.*%S)' or '' @@ -91,12 +81,8 @@ cimport = (...) -> return libnvim -testinc = os.getenv 'TEST_INCLUDES' -unless testinc - testinc = './build/test/includes/post' - cppimport = (path) -> - return cimport testinc .. '/' .. path + return cimport Paths.test_include_path .. '/' .. path cimport './src/types.h' |