neovim/cmake/RunTests.cmake

105 lines
3.3 KiB
CMake
Raw Normal View History

test: force LC_ALL=en_US.UTF-8 Tests that check localized error messages need a stable locale, else errors like this occur: [ FAILED ] 2 tests, listed below: [ FAILED ] ...npack/file/vim/neovim/test/functional/eval/null_spec.lua @ 29: NULL list is accepted as an empty list by writefile() ...npack/file/vim/neovim/test/functional/eval/null_spec.lua:30: Expected objects to be the same. Passed in: (string) ' E484: Cannot open file Xtest-functional-viml-null' Expected: (string) ' E484: Can't open file Xtest-functional-viml-null' stack traceback: ...npack/file/vim/neovim/test/functional/eval/null_spec.lua:30: in function <...npack/file/vim/neovim/test/functional/eval/null_spec.lua:29> [ FAILED ] ...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua @ 81: :write errors out correctly ...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua:97: Expected objects to be the same. Passed in: (string) 'Vim(write):E510: Cannot make backup file (add ! to override)' Expected: (string) 'Vim(write):E510: Can't make backup file (add ! to override)' stack traceback: ...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua:97: in function <...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua:81> 10 SKIPPED TESTS 2 FAILED TESTS -- Output to stderr: 2017/07/29 00:41:32 ERROR 31133/open_log_file:170: Logging to stderr, failed to open $NVIM_LOG_FILE: Xtest-startup-xdg-logpath/nvim/log 2017/07/29 00:41:32 WARN 31133/call_set_error:815: RPC: ch 1 was closed by the client CMake Error at /home/shlomif/Download/unpack/file/vim/neovim/cmake/RunTests.cmake:50 (message): Running functional tests failed with error: 1. FAILED: CMakeFiles/functionaltest cd /home/shlomif/Download/unpack/file/vim/neovim/build && /usr/bin/cmake -DBUSTED_PRG=/home/shlomif/Download/unpack/file/vim/neovim/.deps/usr/bin/busted -DLUA_PRG=/home/shlomif/Download/unpack/file/vim/neovim/.deps/usr/bin/luajit -DNVIM_PRG=/home/shlomif/Download/unpack/file/vim/neovim/build/bin/nvim -DWORKING_DIR=/home/shlomif/Download/unpack/file/vim/neovim -DBUSTED_OUTPUT_TYPE=nvim -DTEST_DIR=/home/shlomif/Download/unpack/file/vim/neovim/test -DBUILD_DIR=/home/shlomif/Download/unpack/file/vim/neovim/build -DTEST_TYPE=functional -DSYSTEM_NAME=Linux -P /home/shlomif/Download/unpack/file/vim/neovim/cmake/RunTests.cmake ninja: build stopped: subcommand failed. Makefile:102: recipe for target 'functionaltest' failed make: *** [functionaltest] Error 1
2017-07-28 15:34:14 -07:00
# Set LC_ALL to meet expectations of some locale-sensitive tests.
set(ENV{LC_ALL} "en_US.UTF-8")
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)
set(ENV{XDG_DATA_HOME} ${BUILD_DIR}/Xtest_xdg/share)
unset(ENV{XDG_DATA_DIRS})
unset(ENV{NVIM}) # Clear $NVIM in case tests are running from Nvim. #11009
# TODO(dundargoc): The CIRRUS_CI environment variable isn't passed to here from
# the main CMakeLists.txt, so we have to manually pass it to this script and
# re-set the environment variable. Investigate if we can avoid manually setting
# it like with the GITHUB_CI environment variable.
set(ENV{CIRRUS_CI} ${CIRRUS_CI})
if(NOT DEFINED ENV{NVIM_LOG_FILE})
set(ENV{NVIM_LOG_FILE} ${BUILD_DIR}/.nvimlog)
endif()
if(NVIM_PRG)
set(ENV{NVIM_PRG} "${NVIM_PRG}")
endif()
if(DEFINED ENV{TEST_FILE})
set(TEST_PATH "$ENV{TEST_FILE}")
else()
set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
endif()
# Force $TEST_PATH to workdir-relative path ("test/…").
if(IS_ABSOLUTE ${TEST_PATH})
file(RELATIVE_PATH TEST_PATH "${WORKING_DIR}" "${TEST_PATH}")
endif()
set(BUSTED_ARGS $ENV{BUSTED_ARGS})
separate_arguments(BUSTED_ARGS)
if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "")
list(APPEND BUSTED_ARGS --tags $ENV{TEST_TAG})
endif()
if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
list(APPEND BUSTED_ARGS --filter $ENV{TEST_FILTER})
endif()
if(DEFINED ENV{TEST_FILTER_OUT} AND NOT "$ENV{TEST_FILTER_OUT}" STREQUAL "")
list(APPEND BUSTED_ARGS --filter-out $ENV{TEST_FILTER_OUT})
endif()
# TMPDIR: for helpers.tmpname() and Nvim tempname().
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR})
# HISTFILE: do not write into user's ~/.bash_history
set(ENV{HISTFILE} "/dev/null")
if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "")
set(ENV{TEST_TIMEOUT} 1200)
endif()
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
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 <test/functional/terminal/tui_spec.lua:1017> 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 <test/functional/terminal/tui_spec.lua:1551>
2023-09-11 10:01:00 -07:00
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.
COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR} busted -v -o test.busted.outputHandlers.nvim
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
--lpath=${BUILD_DIR}/?.lua
--lpath=${WORKING_DIR}/runtime/lua/?.lua
--lpath=?.lua
${BUSTED_ARGS}
${TEST_PATH}
TIMEOUT $ENV{TEST_TIMEOUT}
WORKING_DIRECTORY ${WORKING_DIR}
ERROR_VARIABLE err
RESULT_VARIABLE res
${EXTRA_ARGS})
file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*)
file(REMOVE_RECURSE ${RM_FILES})
if(res)
message(STATUS "Tests exited non-zero: ${res}")
if("${err}" STREQUAL "")
message(STATUS "No output to stderr.")
else()
message(STATUS "Output to stderr:\n${err}")
endif()
# Dump the logfile on CI (if not displayed and moved already).
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}")
endif()
endif()
2022-03-02 17:16:31 -07:00
message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}")
endif()