From 13aa23b62af4df3e7f10687b76fe8c04efa2a598 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 30 Jan 2023 20:36:49 +0100 Subject: refactor(tests): run unittests using main nvim binary in interpreter mode This allows us to get rid of the separate "nvim-test" target --- cmake/RunTests.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index c3ac5f208e..d724f43a5f 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -71,8 +71,16 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "") endif() set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. + +# TODO: eventually always use NVIM_PRG as the runner +if("${TEST_TYPE}" STREQUAL "unit") + set(RUNNER_PRG ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua) +else() + set(RUNNER_PRG ${BUSTED_PRG}) +endif() + execute_process( - COMMAND ${BUSTED_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} + COMMAND ${RUNNER_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua --lpath=${WORKING_DIR}/runtime/lua/?.lua -- cgit From d6279f9392073cb1422d76c57baf3fd283ed954e Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 31 Jan 2023 23:35:04 +0100 Subject: refactor(tests): move lua-client into core and use it for functionaltests Eliminates lua-client and non-static libluv as test time dependencies Note: the API for a public lua-client is not yet finished. The interface needs to be adjusted to work in the embedded loop of a nvim instance (to use it to talk between instances) --- cmake/RunTests.cmake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index d724f43a5f..3ac15f91ea 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -71,16 +71,10 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "") endif() set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. - -# TODO: eventually always use NVIM_PRG as the runner -if("${TEST_TYPE}" STREQUAL "unit") - set(RUNNER_PRG ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua) -else() - set(RUNNER_PRG ${BUSTED_PRG}) -endif() +set(ENV{DEPS_PREFIX} ${DEPS_PREFIX}) # used by test/busted_runner.lua on windows execute_process( - COMMAND ${RUNNER_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} + COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua --lpath=${WORKING_DIR}/runtime/lua/?.lua -- cgit From f573fcbc0d2c8d8143f38c3c53f6cc33a5912c6d Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 12 Feb 2023 14:42:00 +0100 Subject: build: don't check environment variable to detect CI (#22234) Instead use the cmake option, which should act as the definitive source to determine whether we use CI or not. --- cmake/RunTests.cmake | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 3ac15f91ea..fe346661b5 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -1,13 +1,5 @@ # Set LC_ALL to meet expectations of some locale-sensitive tests. set(ENV{LC_ALL} "en_US.UTF-8") - -if(POLICY CMP0012) - # Avoid policy warning due to CI=true. This is needed even if the main - # project has already set this policy as project settings aren't inherited - # when using cmake script mode (-P). - cmake_policy(SET CMP0012 NEW) -endif() - set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime) set(ENV{NVIM_RPLUGIN_MANIFEST} ${BUILD_DIR}/Xtest_rplugin_manifest) set(ENV{XDG_CONFIG_HOME} ${BUILD_DIR}/Xtest_xdg/config) @@ -99,7 +91,7 @@ if(NOT res EQUAL 0) endif() # Dump the logfile on CI (if not displayed and moved already). - if($ENV{CI}) + if(CI_BUILD) if(EXISTS $ENV{NVIM_LOG_FILE} AND NOT EXISTS $ENV{NVIM_LOG_FILE}.displayed) file(READ $ENV{NVIM_LOG_FILE} out) message(STATUS "$NVIM_LOG_FILE: $ENV{NVIM_LOG_FILE}\n${out}") -- cgit From 10860164778327c0009f6efc8e020308cadb13a2 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 13 May 2023 12:12:29 +0200 Subject: build: cmake cleanup - Simplify error checking when using execute_process. - Set BUILD_SHARED_LIBS to OFF when building dependencies. This is normally not needed, but msgpack interprets an unset BUILD_SHARED_LIBS to build a shared library, which is the opposite of the cmake behavior. - Move function check_lua_module to Util.cmake. - Remove unnecessary code. - Make variable naming more consistent --- cmake/RunTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index fe346661b5..1dcb6fb373 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -82,7 +82,7 @@ execute_process( file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*) file(REMOVE_RECURSE ${RM_FILES}) -if(NOT res EQUAL 0) +if(res) message(STATUS "Tests exited non-zero: ${res}") if("${err}" STREQUAL "") message(STATUS "No output to stderr.") -- cgit From 8b8e60728486e1fbb308bee2961175be355e550a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 21 May 2023 20:57:39 +0200 Subject: build: move luarocks and rocks installation to main build This will ensure luacheck and busted are only installed when they're actually needed. This cuts total build time by over 50%. Closes https://github.com/neovim/neovim/issues/22797. --- cmake/RunTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 1dcb6fb373..e1a0c8d6c3 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -63,7 +63,7 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "") endif() set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. -set(ENV{DEPS_PREFIX} ${DEPS_PREFIX}) # used by test/busted_runner.lua on windows +set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua execute_process( COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} -- cgit From 43ded8d3584477ab14731486cfb0e86534f2b2dc Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Jul 2023 03:45:45 -0700 Subject: feat(version): unverbose ":version", ":verbose version" #24195 Problem: `nvim -v` and `:version` prints system vimrc, fallback files, and compilation info by default, which most people don't care about and just clutters up the output. Solution: Omit extra info unless 'verbose' is set. --- cmake/RunTests.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index e1a0c8d6c3..5e83b72235 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -66,6 +66,8 @@ set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua execute_process( + # Note: because of "-ll" (low-level interpreter mode), some modules like + # _editor.lua are not loaded. COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua -- cgit From 6985e12caef4c0d55c895980e423cb188c3fc5c8 Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 5 Sep 2023 11:49:08 +0200 Subject: refactor(build): derocksify luacheck --- cmake/RunTests.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 5e83b72235..d470793a27 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -63,12 +63,11 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "") endif() set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. -set(ENV{DEPS_INSTALL_DIR} ${DEPS_INSTALL_DIR}) # used by test/busted_runner.lua execute_process( # Note: because of "-ll" (low-level interpreter mode), some modules like # _editor.lua are not loaded. - COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/busted_runner.lua -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} + COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR} busted -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua --lpath=${WORKING_DIR}/runtime/lua/?.lua -- cgit From f859d16aea0d58e572edc9aaf1de3542569e10a9 Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Mon, 11 Sep 2023 21:01:00 +0400 Subject: fix(tests): set SHELL=sh #24941 Problem: Some tests fail with $SHELL=fish #6172 Related: https://github.com/neovim/neovim/pull/6176 Solution: Replace "echo -n" with "printf", because "echo" in sh may be provided as a shell builtin, which does not accept an "-n" flag to avoid a trailing newline (e.g. on macos). "printf" is more portable (defined by POSIX) and it does not output a trailing newline by itself. Fixes #6172 TODO: Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354 Checked by running `:terminal ./build/bin/tty-test` from Nvim with `shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains about "process does not own the terminal". With `shell=sh` it doesn't complain. And unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`. FAILED test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode test/functional/terminal/tui_spec.lua:1024: Row 1 did not match. Expected: |*tty ready | |*{1: } | |* | | | |{5:^^^^^^^ }| |{3:-- TERMINAL --} | |{3:-- TERMINAL --} | Actual: |*process does not own the terminal | |* | |*[Process exited 2]{1: } | | | |{5:^^^^^^^ }| |{3:-- TERMINAL --} | |{3:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. stack traceback: test/functional/ui/screen.lua:622: in function '_wait' test/functional/ui/screen.lua:352: in function 'expect' test/functional/terminal/tui_spec.lua:1024: in function FAILED test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors test/functional/terminal/tui_spec.lua:1567: Row 1 did not match. Expected: |*{1:t}ty ready | | | |* | | | |{2:^^^^^^^ }| | | |{3:-- TERMINAL --} | Actual: |*{1:p}rocess does not own the terminal | | | |*[Process exited 2] | | | |{2:^^^^^^^ }| | | |{3:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. stack traceback: test/functional/ui/screen.lua:622: in function '_wait' test/functional/ui/screen.lua:352: in function 'expect' test/functional/terminal/tui_spec.lua:1567: in function --- cmake/RunTests.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmake/RunTests.cmake') diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index d470793a27..8d5b0d2402 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -64,6 +64,11 @@ endif() set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. +if(NOT WIN32) + # Tests assume POSIX "sh" and may fail if SHELL=fish. #24941 #6172 + set(ENV{SHELL} sh) +endif() + execute_process( # Note: because of "-ll" (low-level interpreter mode), some modules like # _editor.lua are not loaded. -- cgit