From 2bf08691609c763cc8a87e38ba24596ff8622a79 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 8 Mar 2018 20:28:51 +0100 Subject: [PATCH 01/11] test: handle non-deterministic message cadence --- test/functional/core/job_spec.lua | 44 ++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index e3c93d4b5a..e260069ea7 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -292,8 +292,16 @@ describe('jobs', function() nvim('command', 'let g:job_opts.user = {"n": 5, "s": "str", "l": [1]}') nvim('command', [[call jobstart('echo "foo"', g:job_opts)]]) local data = {n = 5, s = 'str', l = {1}} - eq({'notification', 'stdout', {data, {'foo', ''}}}, next_msg()) - eq({'notification', 'stdout', {data, {''}}}, next_msg()) + expect_msg_seq( + { {'notification', 'stdout', {data, {'foo', ''}}}, + {'notification', 'stdout', {data, {''}}}, + }, + -- Alternative sequence: + { {'notification', 'stdout', {data, {'foo'}}}, + {'notification', 'stdout', {data, {'', ''}}}, + {'notification', 'stdout', {data, {''}}}, + } + ) eq({'notification', 'exit', {data, 0}}, next_msg()) end) @@ -310,11 +318,12 @@ describe('jobs', function() nvim('command', [[call jobstart('echo "foo"', g:job_opts)]]) expect_msg_seq( { {'notification', 'stdout', {5, {'foo', ''} } }, - {'notification', 'stdout', {5, {''} } } + {'notification', 'stdout', {5, {''} } }, }, -- Alternative sequence: { {'notification', 'stdout', {5, {'foo'} } }, - {'notification', 'stdout', {5, {'', ''} } } + {'notification', 'stdout', {5, {'', ''} } }, + {'notification', 'stdout', {5, {''} } }, } ) end) @@ -417,7 +426,14 @@ describe('jobs', function() let g:job_opts = {'on_stdout': Callback} call jobstart('echo "some text"', g:job_opts) ]]) - eq({'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, next_msg()) + expect_msg_seq( + { {'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, + }, + -- Alternative sequence: + { {'notification', '1', {'foo', 'bar', {'some text'}, 'stdout'}}, + {'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, + } + ) end) it('jobstart() works with closures', function() @@ -430,7 +446,14 @@ describe('jobs', function() let g:job_opts = {'on_stdout': MkFun()} call jobstart('echo "some text"', g:job_opts) ]]) - eq({'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, next_msg()) + expect_msg_seq( + { {'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, + }, + -- Alternative sequence: + { {'notification', '1', {'foo', 'bar', {'some text'}, 'stdout'}}, + {'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, + } + ) end) it('jobstart() works when closure passed directly to `jobstart`', function() @@ -438,7 +461,14 @@ describe('jobs', function() let g:job_opts = {'on_stdout': {id, data, event -> rpcnotify(g:channel, '1', 'foo', 'bar', Normalize(data), event)}} call jobstart('echo "some text"', g:job_opts) ]]) - eq({'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, next_msg()) + expect_msg_seq( + { {'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, + }, + -- Alternative sequence: + { {'notification', '1', {'foo', 'bar', {'some text'}, 'stdout'}}, + {'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, + } + ) end) describe('jobwait', function() From d554a6c7f0e9ed84f2e16d4977740a1584d11198 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 8 Mar 2018 20:31:34 +0100 Subject: [PATCH 02/11] ci/AppVeyor: fix `set` whitespace quoting --- ci/build.bat | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ci/build.bat b/ci/build.bat index 3fa185f646..8bf310851e 100644 --- a/ci/build.bat +++ b/ci/build.bat @@ -6,19 +6,19 @@ if "%CONFIGURATION%" == "MINGW_32" ( set ARCH=x86_64 set BITS=64 if "%CONFIGURATION%" == "MINGW_64-gcov" ( - set USE_GCOV="-DUSE_GCOV=ON" + set "USE_GCOV=-DUSE_GCOV=ON" ) ) else if "%CONFIGURATION%" == "MSVC_32" ( - set CMAKE_GENERATOR="Visual Studio 15 2017" + set "CMAKE_GENERATOR=Visual Studio 15 2017" ) else if "%CONFIGURATION%" == "MSVC_64" ( - set CMAKE_GENERATOR="Visual Studio 15 2017 Win64" + set "CMAKE_GENERATOR=Visual Studio 15 2017 Win64" ) if "%CONFIGURATION:~0,5%" == "MINGW" ( :: These are native MinGW builds, but they use the toolchain inside :: MSYS2, this allows using all the dependencies and tools available :: in MSYS2, but we cannot build inside the MSYS2 shell. - set CMAKE_GENERATOR="MinGW Makefiles" + set "CMAKE_GENERATOR=MinGW Makefiles" set CMAKE_GENERATOR_ARGS=VERBOSE=1 :: Add MinGW to the PATH and remove the Git directory because it :: has a conflicting sh.exe @@ -49,14 +49,14 @@ where.exe neovim-node-host.cmd || goto :error mkdir .deps cd .deps -cmake -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\third-party\ || goto :error +cmake -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\third-party\ || goto :error cmake --build . -- %CMAKE_GENERATOR_ARGS% || goto :error cd .. :: Build Neovim mkdir build cd build -cmake -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUSTED_OUTPUT_TYPE=nvim %USE_GCOV% -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error +cmake -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUSTED_OUTPUT_TYPE=nvim %USE_GCOV% -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error cmake --build . --config RelWithDebInfo -- %CMAKE_GENERATOR_ARGS% || goto :error bin\nvim --version || goto :error @@ -78,7 +78,7 @@ if defined USE_GCOV ( ) :: The default cpack in the PATH is not CMake -set PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH% +set "PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH%" :: Build artifacts cpack -G ZIP -C RelWithDebInfo if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C RelWithDebInfo From fd4021387e696c7a2da4ad776789cfbb938d5332 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 9 Mar 2018 00:24:38 +0100 Subject: [PATCH 03/11] test: rename next_message() to next_msg() --- .../functional/api/server_notifications_spec.lua | 16 ++++++++-------- test/functional/api/server_requests_spec.lua | 10 +++++----- test/functional/autocmd/cmdline_spec.lua | 2 +- test/functional/core/channels_spec.lua | 2 +- test/functional/core/job_spec.lua | 2 +- .../ex_cmds/dict_notifications_spec.lua | 2 +- test/functional/helpers.lua | 10 +++++----- test/functional/ui/input_spec.lua | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua index 9d7cfb9b78..1d64ae7103 100644 --- a/test/functional/api/server_notifications_spec.lua +++ b/test/functional/api/server_notifications_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) -local eq, clear, eval, command, nvim, next_message = +local eq, clear, eval, command, nvim, next_msg = helpers.eq, helpers.clear, helpers.eval, helpers.command, helpers.nvim, - helpers.next_message + helpers.next_msg local meths = helpers.meths describe('notify', function() @@ -15,10 +15,10 @@ describe('notify', function() describe('passing a valid channel id', function() it('sends the notification/args to the corresponding channel', function() eval('rpcnotify('..channel..', "test-event", 1, 2, 3)') - eq({'notification', 'test-event', {1, 2, 3}}, next_message()) + eq({'notification', 'test-event', {1, 2, 3}}, next_msg()) command('au FileType lua call rpcnotify('..channel..', "lua!")') command('set filetype=lua') - eq({'notification', 'lua!', {}}, next_message()) + eq({'notification', 'lua!', {}}, next_msg()) end) end) @@ -28,13 +28,13 @@ describe('notify', function() eval('rpcnotify(0, "event1", 1, 2, 3)') eval('rpcnotify(0, "event2", 4, 5, 6)') eval('rpcnotify(0, "event2", 7, 8, 9)') - eq({'notification', 'event2', {4, 5, 6}}, next_message()) - eq({'notification', 'event2', {7, 8, 9}}, next_message()) + eq({'notification', 'event2', {4, 5, 6}}, next_msg()) + eq({'notification', 'event2', {7, 8, 9}}, next_msg()) nvim('unsubscribe', 'event2') nvim('subscribe', 'event1') eval('rpcnotify(0, "event2", 10, 11, 12)') eval('rpcnotify(0, "event1", 13, 14, 15)') - eq({'notification', 'event1', {13, 14, 15}}, next_message()) + eq({'notification', 'event1', {13, 14, 15}}, next_msg()) end) it('does not crash for deeply nested variable', function() @@ -42,7 +42,7 @@ describe('notify', function() local nest_level = 1000 meths.command(('call map(range(%u), "extend(g:, {\'l\': [g:l]})")'):format(nest_level - 1)) eval('rpcnotify('..channel..', "event", g:l)') - local msg = next_message() + local msg = next_msg() eq('notification', msg[1]) eq('event', msg[2]) local act_ret = msg[3] diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index 37ac532d18..18229b54ff 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -6,7 +6,7 @@ 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 -local source, next_message = helpers.source, helpers.next_message +local source, next_msg = helpers.source, helpers.next_msg local ok = helpers.ok local meths = helpers.meths local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv @@ -258,12 +258,12 @@ describe('server -> client', function() it('rpc and text stderr can be combined', function() eq("ok",funcs.rpcrequest(jobid, "poll")) funcs.rpcnotify(jobid, "ping") - eq({'notification', 'pong', {}}, next_message()) + eq({'notification', 'pong', {}}, next_msg()) eq("done!",funcs.rpcrequest(jobid, "write_stderr", "fluff\n")) - eq({'notification', 'stderr', {0, {'fluff', ''}}}, next_message()) + eq({'notification', 'stderr', {0, {'fluff', ''}}}, next_msg()) funcs.rpcrequest(jobid, "exit") - eq({'notification', 'stderr', {0, {''}}}, next_message()) - eq({'notification', 'exit', {0, 0}}, next_message()) + eq({'notification', 'stderr', {0, {''}}}, next_msg()) + eq({'notification', 'exit', {0, 0}}, next_msg()) end) end) diff --git a/test/functional/autocmd/cmdline_spec.lua b/test/functional/autocmd/cmdline_spec.lua index 8d56687f7d..8ea086fb46 100644 --- a/test/functional/autocmd/cmdline_spec.lua +++ b/test/functional/autocmd/cmdline_spec.lua @@ -5,7 +5,7 @@ local clear = helpers.clear local command = helpers.command local eq = helpers.eq local expect = helpers.expect -local next_msg = helpers.next_message +local next_msg = helpers.next_msg local feed = helpers.feed local meths = helpers.meths diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua index e9fc88c01b..f79f208b69 100644 --- a/test/functional/core/channels_spec.lua +++ b/test/functional/core/channels_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear, eq, eval, next_msg, ok, source = helpers.clear, helpers.eq, - helpers.eval, helpers.next_message, helpers.ok, helpers.source + helpers.eval, helpers.next_msg, helpers.ok, helpers.source local command, funcs, meths = helpers.command, helpers.funcs, helpers.meths local sleep = helpers.sleep local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index e260069ea7..c5326aedfe 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear, eq, eval, exc_exec, feed_command, feed, insert, neq, next_msg, nvim, nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear, helpers.eq, helpers.eval, helpers.exc_exec, helpers.feed_command, helpers.feed, - helpers.insert, helpers.neq, helpers.next_message, helpers.nvim, + helpers.insert, helpers.neq, helpers.next_msg, helpers.nvim, helpers.nvim_dir, helpers.ok, helpers.source, helpers.write_file, helpers.mkdir, helpers.rmdir local command = helpers.command diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua index e3b4a1c504..3d550588e7 100644 --- a/test/functional/ex_cmds/dict_notifications_spec.lua +++ b/test/functional/ex_cmds/dict_notifications_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local clear, nvim, source = helpers.clear, helpers.nvim, helpers.source -local eq, next_msg = helpers.eq, helpers.next_message +local eq, next_msg = helpers.eq, helpers.next_msg local exc_exec = helpers.exc_exec local command = helpers.command local eval = helpers.eval diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 1f53200dd8..72b086c574 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -97,14 +97,14 @@ local function request(method, ...) return rv end -local function next_message(timeout) +local function next_msg(timeout) return session:next_message(timeout) end local function expect_twostreams(msgs1, msgs2) local pos1, pos2 = 1, 1 while pos1 <= #msgs1 or pos2 <= #msgs2 do - local msg = next_message() + local msg = next_msg() if pos1 <= #msgs1 and pcall(eq, msgs1[pos1], msg) then pos1 = pos1 + 1 elseif pos2 <= #msgs2 then @@ -117,7 +117,7 @@ local function expect_twostreams(msgs1, msgs2) end end --- Expects a sequence of next_message() results. If multiple sequences are +-- Expects a sequence of next_msg() results. If multiple sequences are -- passed they are tried until one succeeds, in order of shortest to longest. local function expect_msg_seq(...) if select('#', ...) < 1 then @@ -140,7 +140,7 @@ local function expect_msg_seq(...) local expected_seq = seqs[anum] -- Collect enough messages to compare the next expected sequence. while #actual_seq < #expected_seq do - local msg = next_message(10000) -- Big timeout for ASAN/valgrind. + local msg = next_msg(10000) -- Big timeout for ASAN/valgrind. if msg == nil then error(cat_err(final_error, string.format('got %d messages, expected %d', @@ -754,7 +754,7 @@ local module = { mkdir = lfs.mkdir, neq = neq, new_pipename = new_pipename, - next_message = next_message, + next_msg = next_msg, nvim = nvim, nvim_argv = nvim_argv, nvim_async = nvim_async, diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 7d5521485c..8e62a37ef1 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local clear, feed_command, nvim = helpers.clear, helpers.feed_command, helpers.nvim -local feed, next_message, eq = helpers.feed, helpers.next_message, helpers.eq +local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq local expect = helpers.expect local write_file = helpers.write_file local Screen = require('test.functional.ui.screen') @@ -16,7 +16,7 @@ describe('mappings', function() local check_mapping = function(mapping, expected) feed(mapping) - eq({'notification', 'mapped', {expected}}, next_message()) + eq({'notification', 'mapped', {expected}}, next_msg()) end before_each(function() From 496b0f944fcbfd84db9e2dd625c6b756a3d1e467 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 9 Mar 2018 00:29:20 +0100 Subject: [PATCH 04/11] test: next_msg(): default `timeout` to 10s Infinite timeout results in hangs which waste time. If some test needs longer than 10s to wait for a message, it should specify the timeout explicitly. --- test/functional/helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 72b086c574..b8d912114d 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -98,7 +98,7 @@ local function request(method, ...) end local function next_msg(timeout) - return session:next_message(timeout) + return session:next_message(timeout and timeout or 10000) end local function expect_twostreams(msgs1, msgs2) From 90963a9c55b188f6598e7c549ec2718cf3dd668f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 8 Mar 2018 23:57:08 +0100 Subject: [PATCH 05/11] build/luarocks: apply "Fix siteconfig" patch upstream: https://github.com/luarocks/luarocks/pull/774 --- third-party/CMakeLists.txt | 8 ++---- third-party/cmake/BuildLuarocks.cmake | 4 +++ .../patches/luarocks-Fix-siteconfig.patch | 28 +++++++++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 third-party/patches/luarocks-Fix-siteconfig.patch diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 7c95bbb91d..fb3166b70f 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -50,11 +50,9 @@ endif() option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF) -if(WIN32) - find_package(Git) - if(NOT Git_FOUND) - message(FATAL_ERROR "Git is required to apply patches for Windows.") - endif() +find_package(Git) +if(NOT Git_FOUND) + message(FATAL_ERROR "Git is required to apply patches to bundled dependencies") endif() if(UNIX) diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake index 47c6412d86..2b85e3fd82 100644 --- a/third-party/cmake/BuildLuarocks.cmake +++ b/third-party/cmake/BuildLuarocks.cmake @@ -70,6 +70,10 @@ if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING)) endif() BuildLuarocks( + PATCH_COMMAND + ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks init + COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks apply + ${CMAKE_CURRENT_SOURCE_DIR}/patches/luarocks-Fix-siteconfig.patch CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure --prefix=${HOSTDEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS} INSTALL_COMMAND ${MAKE_PRG} bootstrap) diff --git a/third-party/patches/luarocks-Fix-siteconfig.patch b/third-party/patches/luarocks-Fix-siteconfig.patch new file mode 100644 index 0000000000..fbc9e664d2 --- /dev/null +++ b/third-party/patches/luarocks-Fix-siteconfig.patch @@ -0,0 +1,28 @@ +From dad6687372b1568f1543388d5014190a076e388a Mon Sep 17 00:00:00 2001 +Date: Thu, 8 Mar 2018 22:50:52 +0100 +Subject: [PATCH] Fix site_config + +--- + src/luarocks/cfg.lua | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua +index 1d5c9872e205..aa34a4f9748b 100644 +--- a/src/luarocks/cfg.lua ++++ b/src/luarocks/cfg.lua +@@ -23,10 +23,10 @@ local version_suffix = cfg.lua_version:gsub("%.", "_") + + -- Load site-local global configurations + local ok, site_config = pcall(require, "luarocks.site_config_"..version_suffix) +-if not ok then ++if not ok or type(site_config) ~= "table" then + ok, site_config = pcall(require, "luarocks.site_config") + end +-if not ok then ++if not ok or type(site_config) ~= "table" then + io.stderr:write("Site-local luarocks/site_config.lua file not found. Incomplete installation?\n") + site_config = {} + end +-- +2.7.4 + From de919b9b9405b2a3c820dc8992583179ca732354 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 9 Mar 2018 00:36:17 +0100 Subject: [PATCH 06/11] build/luarocks: avoid parallelism for luarocks build Is there a race between the luarocks `make bootstrap` dependencies? reverts f73b4911312b35bfe38ed068672a2f8ba8875ba7 ref https://github.com/luarocks/luarocks/pull/774 --- third-party/CMakeLists.txt | 8 ++++-- third-party/cmake/BuildLuarocks.cmake | 6 +--- .../patches/luarocks-Fix-siteconfig.patch | 28 ------------------- 3 files changed, 6 insertions(+), 36 deletions(-) delete mode 100644 third-party/patches/luarocks-Fix-siteconfig.patch diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index fb3166b70f..7c95bbb91d 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -50,9 +50,11 @@ endif() option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF) -find_package(Git) -if(NOT Git_FOUND) - message(FATAL_ERROR "Git is required to apply patches to bundled dependencies") +if(WIN32) + find_package(Git) + if(NOT Git_FOUND) + message(FATAL_ERROR "Git is required to apply patches for Windows.") + endif() endif() if(UNIX) diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake index 2b85e3fd82..f9960495fc 100644 --- a/third-party/cmake/BuildLuarocks.cmake +++ b/third-party/cmake/BuildLuarocks.cmake @@ -70,13 +70,9 @@ if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING)) endif() BuildLuarocks( - PATCH_COMMAND - ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks init - COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks apply - ${CMAKE_CURRENT_SOURCE_DIR}/patches/luarocks-Fix-siteconfig.patch CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure --prefix=${HOSTDEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS} - INSTALL_COMMAND ${MAKE_PRG} bootstrap) + INSTALL_COMMAND ${MAKE_PRG} -j1 bootstrap) elseif(MSVC OR MINGW) if(MINGW) diff --git a/third-party/patches/luarocks-Fix-siteconfig.patch b/third-party/patches/luarocks-Fix-siteconfig.patch deleted file mode 100644 index fbc9e664d2..0000000000 --- a/third-party/patches/luarocks-Fix-siteconfig.patch +++ /dev/null @@ -1,28 +0,0 @@ -From dad6687372b1568f1543388d5014190a076e388a Mon Sep 17 00:00:00 2001 -Date: Thu, 8 Mar 2018 22:50:52 +0100 -Subject: [PATCH] Fix site_config - ---- - src/luarocks/cfg.lua | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua -index 1d5c9872e205..aa34a4f9748b 100644 ---- a/src/luarocks/cfg.lua -+++ b/src/luarocks/cfg.lua -@@ -23,10 +23,10 @@ local version_suffix = cfg.lua_version:gsub("%.", "_") - - -- Load site-local global configurations - local ok, site_config = pcall(require, "luarocks.site_config_"..version_suffix) --if not ok then -+if not ok or type(site_config) ~= "table" then - ok, site_config = pcall(require, "luarocks.site_config") - end --if not ok then -+if not ok or type(site_config) ~= "table" then - io.stderr:write("Site-local luarocks/site_config.lua file not found. Incomplete installation?\n") - site_config = {} - end --- -2.7.4 - From ffad8d4c51aed30eca90065cf0c92e404759e5ac Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 8 Mar 2018 20:35:10 +0100 Subject: [PATCH 07/11] ci/AppVeyor: disable MSVC_32 build The MSVC_32 currently hangs. When MSVC becomes the primary Windows target, we can enable MSVC_32 and retire one of the mingw builds. In the meantime it adds too much time. --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8c2c89560c..ab2bfc92fe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,15 +3,14 @@ environment: APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9" image: Visual Studio 2017 configuration: -- MSVC_64 -- MSVC_32 - MINGW_64 - MINGW_32 +- MSVC_64 +# - MSVC_32 - MINGW_64-gcov matrix: allow_failures: - configuration: MSVC_64 - - configuration: MSVC_32 - configuration: MINGW_64-gcov install: [] before_build: From 968c7ab17eedd7f3c53f3860ff6fbcaddca417e0 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 9 Mar 2018 20:55:10 +0100 Subject: [PATCH 08/11] ci/travis: use ninja instead of make --- .travis.yml | 4 +--- Makefile | 2 -- ci/common/build.sh | 9 ++++++--- ci/install.sh | 1 + ci/run_lint.sh | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 565d4098b1..5f848e7ced 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,6 @@ env: global: # To force rebuilding of third-party dependencies, set this to 'true'. - BUILD_NVIM_DEPS=false - # Travis has 1.5 virtual cores according to - # http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM - - MAKE_CMD="make -j2" # Update PATH for pip. - PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH" # Build directory for Neovim. @@ -115,6 +112,7 @@ addons: - libc6-dev-i386 - libtool - locales + - ninja-build - pkg-config - unzip - valgrind diff --git a/Makefile b/Makefile index 4a880d270a..0681eff7fa 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,6 @@ CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake)) CMAKE_BUILD_TYPE ?= Debug CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) -DOC_DOWNLOAD_URL_BASE := https://raw.githubusercontent.com/neovim/doc/gh-pages -CLINT_ERRORS_FILE_PATH := /reports/clint/errors.json BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \ echo "Unix Makefiles") diff --git a/ci/common/build.sh b/ci/common/build.sh index 2748b15b0d..13305c0bad 100644 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -1,5 +1,8 @@ top_make() { - ${MAKE_CMD} "$@" + echo '================================================================================' + # Travis has 1.5 virtual cores according to: + # http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM + ninja "$@" } build_make() { @@ -36,7 +39,7 @@ build_deps() { # update CMake configuration and update to newer deps versions. cd "${DEPS_BUILD_DIR}" echo "Configuring with '${DEPS_CMAKE_FLAGS}'." - CC= cmake ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/" + CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/" if ! top_make; then exit 1 @@ -56,7 +59,7 @@ prepare_build() { mkdir -p "${BUILD_DIR}" cd "${BUILD_DIR}" echo "Configuring with '${CMAKE_FLAGS} $@'." - cmake ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}" + cmake -G Ninja ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}" } build_nvim() { diff --git a/ci/install.sh b/ci/install.sh index 60d9507bfb..9deaa601b4 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -8,6 +8,7 @@ if [[ "${CI_TARGET}" == lint ]]; then fi if [[ "${TRAVIS_OS_NAME}" == osx ]]; then + brew install ninja brew install gettext brew reinstall -s libtool fi diff --git a/ci/run_lint.sh b/ci/run_lint.sh index e7f6727448..ae9adb7c87 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -10,19 +10,19 @@ source "${CI_DIR}/common/suite.sh" enter_suite 'clint' -run_test 'top_make clint-full' clint +run_test 'make clint-full' clint exit_suite --continue enter_suite 'testlint' -run_test 'top_make testlint' testlint +run_test 'make testlint' testlint exit_suite --continue enter_suite 'lualint' -run_test 'top_make lualint' lualint +run_test 'make lualint' lualint exit_suite --continue @@ -31,7 +31,7 @@ enter_suite single-includes CLICOLOR_FORCE=1 run_test_wd \ --allow-hang \ 10s \ - 'top_make check-single-includes' \ + 'make check-single-includes' \ 'csi_clean' \ single-includes From 45e81e03f880f9ad6f23e57eed00d5178f47fd2f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 10 Mar 2018 20:43:51 +0100 Subject: [PATCH 09/11] ci/macOS: skip python2 on travis macOS macOS travis builds recently started failing (travis caches were cleared recently, maybe related). python2 is reasonably covered by linux CI. Not going to waste time on it for macOS CI. ==> Installing python@2 ==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.14_3.el_capita ==> Pouring python@2-2.7.14_3.el_capitan.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/2to3-2 Target /usr/local/bin/2to3-2 is a symlink belonging to python. You can unlink it: brew unlink python To force the link and overwrite all conflicting files: brew link --overwrite python@2 To list all files that would be deleted: brew link --overwrite --dry-run python@2 Possible conflicting files are: /usr/local/bin/2to3-2 -> /usr/local/Cellar/python/2.7.12_1/bin/2to3-2 /usr/local/bin/2to3-2.7 -> /usr/local/Cellar/python/2.7.12_1/bin/2to3-2.7 /usr/local/bin/idle -> /usr/local/Cellar/python/2.7.12_1/bin/idle ... --- .travis.yml | 4 ---- ci/before_install.sh | 10 ++-------- ci/install.sh | 10 ++++++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f848e7ced..de4e63c020 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ env: global: # To force rebuilding of third-party dependencies, set this to 'true'. - BUILD_NVIM_DEPS=false - # Update PATH for pip. - - PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH" # Build directory for Neovim. - BUILD_DIR="$TRAVIS_BUILD_DIR/build" # Build directory for third-party dependencies. @@ -69,11 +67,9 @@ jobs: - os: osx compiler: clang osx_image: xcode7.3 # macOS 10.11 - env: PATH="/usr/local/opt/python@2/bin:$PATH" - os: osx compiler: gcc osx_image: xcode7.3 # macOS 10.11 - env: PATH="/usr/local/opt/python@2/bin:$PATH" - os: linux env: CI_TARGET=lint - stage: Flaky builds diff --git a/ci/before_install.sh b/ci/before_install.sh index f696b85afc..9a3e192536 100755 --- a/ci/before_install.sh +++ b/ci/before_install.sh @@ -23,20 +23,14 @@ echo 'python info:' 2>&1 pyenv versions || true ) | sed 's/^/ /' -if [[ "${TRAVIS_OS_NAME}" == osx ]]; then - echo "Install Python 2." - brew install python@2 -fi - -echo "Upgrade Python 2 pip." -pip2.7 -q install --user --upgrade pip - if [[ "${TRAVIS_OS_NAME}" == osx ]]; then echo "Upgrade Python 3." brew upgrade python echo "Upgrade Python 3 pip." pip3 -q install --user --upgrade pip else + echo "Upgrade Python 2 pip." + pip2.7 -q install --user --upgrade pip echo "Upgrade Python 3 pip." # Allow failure. pyenv pip3 on travis is broken: # https://github.com/travis-ci/travis-ci/issues/8363 diff --git a/ci/install.sh b/ci/install.sh index 9deaa601b4..053549d6db 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -13,16 +13,18 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then brew reinstall -s libtool fi -# Use default CC to avoid compilation problems when installing Python modules. -echo "Install neovim module for Python 2." -CC=cc pip2.7 -q install --user --upgrade neovim - echo "Install neovim module for Python 3." # Allow failure. pyenv pip3 on travis is broken: # https://github.com/travis-ci/travis-ci/issues/8363 CC=cc pip3 -q install --user --upgrade neovim || true if ! [ "${TRAVIS_OS_NAME}" = osx ] ; then + # Update PATH for pip. + export PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH" + # Use default CC to avoid compilation problems when installing Python modules. + echo "Install neovim module for Python 2." + CC=cc pip2.7 -q install --user --upgrade neovim + echo "Install neovim RubyGem." gem install --no-document --version ">= 0.2.0" neovim fi From 9a0147754c4301a1f94fb339c44666edd22b3bbb Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 11 Mar 2018 13:15:42 +0100 Subject: [PATCH 10/11] build: respect $DEPS_BUILD_DIR Without this, the CI_TARGET=lint travis job cant't find the cached deps (in $HOME/nvim-deps), nor can it update the cache. --- CMakeLists.txt | 4 ++++ Makefile | 20 +++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8147afb14f..4b021ad6e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,11 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(PreventInTreeBuilds) # Prefer our bundled versions of dependencies. +if(DEFINED ENV{DEPS_BUILD_DIR}) +set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies") +else() set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies") +endif() if(CMAKE_CROSSCOMPILING AND NOT UNIX) list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX}) list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin) diff --git a/Makefile b/Makefile index 0681eff7fa..72db67a0d9 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +THIS_DIR = $(shell pwd) filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1)) filter-true = $(strip $(filter-out 1 on ON true TRUE,$1)) @@ -11,6 +12,11 @@ CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \ echo "Unix Makefiles") +DEPS_BUILD_DIR ?= .deps + +ifneq (1,$(words [$(DEPS_BUILD_DIR)])) + $(error DEPS_BUILD_DIR must not contain whitespace) +endif ifeq (,$(BUILD_TOOL)) ifeq (Ninja,$(BUILD_TYPE)) @@ -46,7 +52,7 @@ endif ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS))) BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON - $(shell [ -x .deps/usr/bin/lua ] || rm build/.ran-*) + $(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || rm build/.ran-*) endif # For use where we want to make sure only a single job is run. This does issue @@ -66,20 +72,20 @@ cmake: $(MAKE) build/.ran-cmake build/.ran-cmake: | deps - cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) .. + cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(THIS_DIR) touch $@ deps: | build/.ran-third-party-cmake ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) - +$(BUILD_CMD) -C .deps + +$(BUILD_CMD) -C $(DEPS_BUILD_DIR) endif build/.ran-third-party-cmake: ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) - mkdir -p .deps - cd .deps && \ + mkdir -p $(DEPS_BUILD_DIR) + cd $(DEPS_BUILD_DIR) && \ $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \ - $(DEPS_CMAKE_FLAGS) ../third-party + $(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party endif mkdir -p build touch $@ @@ -122,7 +128,7 @@ clean: $(MAKE) -C runtime/doc clean distclean: clean - rm -rf .deps build + rm -rf $(DEPS_BUILD_DIR) build install: | nvim +$(BUILD_CMD) -C build install From b0b656dd37567dea5e3f58e7821c7442831403cb Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 11 Mar 2018 13:31:10 +0100 Subject: [PATCH 11/11] ci/travis: rename $BUILD_NVIM_DEPS to $CACHE_ENABLE --- .travis.yml | 8 +++----- ci/common/build.sh | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index de4e63c020..451b89888d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ language: c env: global: - # To force rebuilding of third-party dependencies, set this to 'true'. - - BUILD_NVIM_DEPS=false + # Set "false" to force rebuild of third-party dependencies. + - CACHE_ENABLE=true # Build directory for Neovim. - BUILD_DIR="$TRAVIS_BUILD_DIR/build" # Build directory for third-party dependencies. @@ -36,9 +36,7 @@ env: - UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" # Environment variables for Valgrind. - VALGRIND_LOG="$LOG_DIR/valgrind-%p.log" - # Cache marker for third-party dependencies cache. - # If this file exists, we know that the cache contains compiled - # dependencies and we can use it. + # If this file exists, the cache is valid (compile was successful). - CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker" # default target name for functional tests - FUNCTIONALTEST=functionaltest diff --git a/ci/common/build.sh b/ci/common/build.sh index 13305c0bad..772b696969 100644 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -20,14 +20,13 @@ build_deps() { rm -rf "${DEPS_BUILD_DIR}" - # If there is a valid cache and we're not forced to recompile, - # use cached third-party dependencies. - if test -f "${CACHE_MARKER}" && test "${BUILD_NVIM_DEPS}" != "true" ; then + # Use cached dependencies if $CACHE_MARKER exists. + if test -f "${CACHE_MARKER}" && ! test "${CACHE_ENABLE}" = "false" ; then local statcmd="stat -c '%y'" if test "${TRAVIS_OS_NAME}" = osx ; then statcmd="stat -f '%Sm'" fi - echo "Using third-party dependencies from Travis's cache (last updated: $(${statcmd} "${CACHE_MARKER}"))." + echo "Using third-party dependencies from Travis cache (last update: $(${statcmd} "${CACHE_MARKER}"))." mkdir -p "$(dirname "${DEPS_BUILD_DIR}")" mv "${HOME}/.cache/nvim-deps" "${DEPS_BUILD_DIR}"