aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.gitattributes3
-rw-r--r--.github/workflows/ci.yml3
-rw-r--r--CMakeLists.txt121
-rw-r--r--Makefile2
-rwxr-xr-xci/before_cache.sh6
-rwxr-xr-xci/common/submit_coverage.sh56
-rw-r--r--ci/common/suite.sh36
-rw-r--r--ci/common/test.sh19
-rwxr-xr-xci/run_tests.sh9
-rw-r--r--cmake.deps/CMakeLists.txt22
-rw-r--r--cmake.deps/cmake/BuildGettext.cmake4
-rw-r--r--cmake.deps/cmake/BuildLibtermkey.cmake6
-rw-r--r--cmake.deps/cmake/BuildLibuv.cmake6
-rw-r--r--cmake.deps/cmake/BuildLuv.cmake26
-rw-r--r--cmake.deps/cmake/BuildMsgpack.cmake4
-rw-r--r--cmake.deps/cmake/BuildTreesitterParsers.cmake2
-rw-r--r--cmake/FindLibUV.cmake2
-rw-r--r--cmake/WindowsDllCopy.cmake6
-rw-r--r--codecov.yml27
-rw-r--r--runtime/doc/luvref.txt110
-rw-r--r--runtime/doc/options.txt14
-rwxr-xr-xsrc/nvim/CMakeLists.txt97
-rw-r--r--src/nvim/api/ui.c10
-rw-r--r--src/nvim/msgpack_rpc/channel.c11
-rw-r--r--src/nvim/option_defs.h2
-rw-r--r--src/nvim/optionstr.c3
-rw-r--r--src/nvim/po/CMakeLists.txt12
-rwxr-xr-xsrc/nvim/testdir/runnvim.sh4
-rw-r--r--src/nvim/testdir/suite.sh10
-rw-r--r--src/nvim/testdir/test.sh91
-rw-r--r--src/nvim/ui.c6
-rw-r--r--src/nvim/ui.h2
-rw-r--r--test/CMakeLists.txt91
-rw-r--r--test/functional/api/server_requests_spec.lua15
-rw-r--r--test/functional/core/exit_spec.lua32
-rw-r--r--test/functional/terminal/tui_spec.lua5
36 files changed, 470 insertions, 405 deletions
diff --git a/.gitattributes b/.gitattributes
index 1770c9b164..a1aa7e155f 100755
--- a/.gitattributes
+++ b/.gitattributes
@@ -11,6 +11,3 @@ src/unicode/** linguist-vendored
src/nvim/testdir/test42.in diff
.github/ export-ignore
-.travis.yml export-ignore
-codecov.yml export-ignore
-.builds/ export-ignore
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aa2708332c..d3974e8c85 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -171,8 +171,7 @@ jobs:
run: cmake --build build --target lintc-clint
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
- name: check-single-includes
- run: make check-single-includes
+ run: cmake --build build --target clang-tidy
- name: Cache dependencies
run: ./ci/before_cache.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00a1d3f7af..7abbff3471 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,15 +65,15 @@ else()
file(MAKE_DIRECTORY ${DEPS_BUILD_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR}
- -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
- -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
- -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
- -DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
- -DCMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL}
- -DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
- -DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
- -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
+ -D CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
+ -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -D CMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
+ -D CMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL}
+ -D CMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
+ -D CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
+ -D CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
${PROJECT_SOURCE_DIR}/cmake.deps
WORKING_DIRECTORY ${DEPS_BUILD_DIR})
execute_process(
@@ -244,9 +244,9 @@ endif()
# Lint
#
find_program(LUACHECK_PRG luacheck)
+find_program(SHELLCHECK_PRG shellcheck)
find_program(STYLUA_PRG stylua)
find_program(UNCRUSTIFY_PRG uncrustify)
-find_program(SHELLCHECK_PRG shellcheck)
add_glob_target(
REQUIRED
@@ -287,7 +287,7 @@ add_custom_target(lintcommit
add_dependencies(lintcommit nvim)
add_custom_target(lint)
-add_dependencies(lint check-single-includes lintc lintlua lintsh lintcommit)
+add_dependencies(lint clang-tidy lintc lintlua lintsh lintcommit)
#
# Format
@@ -306,10 +306,6 @@ install_helper(
FILES ${CMAKE_SOURCE_DIR}/src/man/nvim.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
-#
-# Go down the tree.
-#
-
if(EXISTS "${DEPS_PREFIX}/share/nvim-qt")
option(USE_BUNDLED_NVIMQT "Bundle neovim-qt" ON)
else()
@@ -318,107 +314,14 @@ endif()
add_subdirectory(src/nvim)
add_subdirectory(cmake.config)
-add_subdirectory(test/functional/fixtures) # compile test programs
add_subdirectory(runtime)
-get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
+add_subdirectory(test)
if(WIN32 AND USE_BUNDLED_NVIMQT)
install_helper(
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin)
endif()
-# Setup busted.
-find_program(BUSTED_PRG NAMES busted busted.bat)
-find_program(BUSTED_LUA_PRG busted-lua)
-if(NOT BUSTED_OUTPUT_TYPE)
- set(BUSTED_OUTPUT_TYPE "nvim")
-endif()
-
-# Setup some test-related bits. We do this after going down the tree because we
-# need some of the targets.
-if(BUSTED_PRG)
- get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES)
-
- set(UNITTEST_PREREQS nvim)
- set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test pwsh-test streams-test tty-test ${GENERATED_HELP_TAGS})
- set(BENCHMARK_PREREQS nvim tty-test)
-
- check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
- if(LUA_HAS_FFI)
- add_custom_target(unittest
- COMMAND ${CMAKE_COMMAND}
- -DBUSTED_PRG=${BUSTED_PRG}
- -DLUA_PRG=${LUA_PRG}
- -DNVIM_PRG=$<TARGET_FILE:nvim>
- -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
- -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
- -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
- -DBUILD_DIR=${CMAKE_BINARY_DIR}
- -DTEST_TYPE=unit
- -DCIRRUS_CI=$ENV{CIRRUS_CI}
- -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
- DEPENDS ${UNITTEST_PREREQS}
- USES_TERMINAL)
- set_target_properties(unittest PROPERTIES FOLDER test)
- else()
- message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
- endif()
-
- configure_file(
- ${CMAKE_SOURCE_DIR}/test/cmakeconfig/paths.lua.in
- ${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua)
-
- add_custom_target(functionaltest
- COMMAND ${CMAKE_COMMAND}
- -DBUSTED_PRG=${BUSTED_PRG}
- -DLUA_PRG=${LUA_PRG}
- -DNVIM_PRG=$<TARGET_FILE:nvim>
- -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
- -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
- -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
- -DBUILD_DIR=${CMAKE_BINARY_DIR}
- -DTEST_TYPE=functional
- -DCIRRUS_CI=$ENV{CIRRUS_CI}
- -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
- DEPENDS ${FUNCTIONALTEST_PREREQS}
- USES_TERMINAL)
- set_target_properties(functionaltest PROPERTIES FOLDER test)
-
- add_custom_target(benchmark
- COMMAND ${CMAKE_COMMAND}
- -DBUSTED_PRG=${BUSTED_PRG}
- -DLUA_PRG=${LUA_PRG}
- -DNVIM_PRG=$<TARGET_FILE:nvim>
- -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
- -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
- -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
- -DBUILD_DIR=${CMAKE_BINARY_DIR}
- -DTEST_TYPE=benchmark
- -DCIRRUS_CI=$ENV{CIRRUS_CI}
- -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
- DEPENDS ${BENCHMARK_PREREQS}
- USES_TERMINAL)
- set_target_properties(benchmark PROPERTIES FOLDER test)
-endif()
-
-if(BUSTED_LUA_PRG)
- add_custom_target(functionaltest-lua
- COMMAND ${CMAKE_COMMAND}
- -DBUSTED_PRG=${BUSTED_LUA_PRG}
- -DLUA_PRG=${LUA_PRG}
- -DNVIM_PRG=$<TARGET_FILE:nvim>
- -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
- -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
- -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
- -DBUILD_DIR=${CMAKE_BINARY_DIR}
- -DTEST_TYPE=functional
- -DCIRRUS_CI=$ENV{CIRRUS_CI}
- -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
- DEPENDS ${FUNCTIONALTEST_PREREQS}
- USES_TERMINAL)
- set_target_properties(functionaltest-lua PROPERTIES FOLDER test)
-endif()
-
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/UninstallHelper.cmake)
diff --git a/Makefile b/Makefile
index be1eef92de..2f7624d707 100644
--- a/Makefile
+++ b/Makefile
@@ -130,7 +130,7 @@ functionaltest-lua: | nvim
$(BUILD_TOOL) -C build $@
FORMAT=formatc formatlua format
-LINT=lintlua lintsh lintc check-single-includes lintcommit lint
+LINT=lintlua lintsh lintc clang-tidy lintcommit lint
TEST=functionaltest unittest
generated-sources benchmark uninstall $(FORMAT) $(LINT) $(TEST): | build/.ran-cmake
$(CMAKE_PRG) --build build --target $@
diff --git a/ci/before_cache.sh b/ci/before_cache.sh
index 7bf66221ae..94c18bd2cf 100755
--- a/ci/before_cache.sh
+++ b/ci/before_cache.sh
@@ -3,14 +3,10 @@
set -e
set -o pipefail
-CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-# shellcheck source-path=SCRIPTDIR
-source "${CI_DIR}/common/suite.sh"
-
mkdir -p "$CACHE_DIR"
# Update the third-party dependency cache only if the build was successful.
-if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then
+if [ -d "${DEPS_BUILD_DIR}" ]; then
# Do not cache downloads. They should not be needed with up-to-date deps.
rm -rf "${DEPS_BUILD_DIR}/build/downloads"
rm -rf "${CACHE_NVIM_DEPS_DIR}"
diff --git a/ci/common/submit_coverage.sh b/ci/common/submit_coverage.sh
deleted file mode 100755
index f781ca8e5e..0000000000
--- a/ci/common/submit_coverage.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-# Collect and submit coverage reports.
-#
-# Args:
-# $1: Flag(s) for codecov, separated by comma.
-
-set -e
-
-# Change to grandparent dir (POSIXly).
-CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit
-
-echo "=== running submit_coverage in $PWD: $* ==="
-"$GCOV" --version
-
-# Download/install codecov-bash and gcovr once.
-codecov_sh="${TEMP:-/tmp}/codecov.bash"
-if ! [ -f "$codecov_sh" ]; then
- curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash
- chmod +x "$codecov_sh"
-
- python -m pip install --quiet --user gcovr
-fi
-
-(
- cd build
- python -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml
-)
-
-# Upload to codecov.
-# -X gcov: disable gcov, done manually above.
-# -X fix: disable fixing of reports (not necessary, rather slow)
-# -Z: exit non-zero on failure
-# -F: flag(s)
-# NOTE: ignoring flags for now, since this causes timeouts on codecov.io then,
-# which they know about for about a year already...
-# Flags must match pattern ^[\w\,]+$ ("," as separator).
-codecov_flags="$(uname -s),${1}"
-codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g')
-if ! "$codecov_sh" -f coverage.xml -X gcov -X fix -Z -F "${codecov_flags}"; then
- echo "codecov upload failed."
-fi
-
-# Cleanup always, especially collected data.
-find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l
-rm -f coverage.xml
-
-# Upload Lua coverage (generated manually on AppVeyor/Windows).
-if [ "$USE_LUACOV" = 1 ] && [ "$1" != "oldtest" ]; then
- if [ -x "${DEPS_BUILD_DIR}/usr/bin/luacov" ]; then
- "${DEPS_BUILD_DIR}/usr/bin/luacov"
- fi
- if ! "$codecov_sh" -f luacov.report.out -X gcov -X fix -Z -F "lua,${codecov_flags}"; then
- echo "codecov upload failed."
- fi
- rm luacov.stats.out
-fi
diff --git a/ci/common/suite.sh b/ci/common/suite.sh
deleted file mode 100644
index 9c3056baaf..0000000000
--- a/ci/common/suite.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-# Test success marker. If END_MARKER file exists, we know that all tests
-# finished. If FAIL_SUMMARY_FILE exists we know that some tests failed, this
-# file will contain information about failed tests. Build is considered
-# successful if tests ended without any of them failing.
-END_MARKER="$BUILD_DIR/.tests_finished"
-FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
-
-fail() {
- local test_name="$1"
- local message="$2"
-
- : "${message:=Test $test_name failed}"
-
- local full_msg="$test_name :: $message"
- echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}"
- echo "Failed: $full_msg"
- export FAILED=1
-}
-
-ended_successfully() {
- if test -f "${FAIL_SUMMARY_FILE}" ; then
- echo 'Test failed, complete summary:'
- cat "${FAIL_SUMMARY_FILE}"
-
- if [[ "$GITHUB_ACTIONS" == "true" ]]; then
- rm -f "$FAIL_SUMMARY_FILE"
- fi
-
- return 1
- fi
- if ! test -f "${END_MARKER}" ; then
- echo 'ended_successfully called before end marker was touched'
- return 1
- fi
- return 0
-}
diff --git a/ci/common/test.sh b/ci/common/test.sh
index c3b8d45b9f..5ef7dc4024 100644
--- a/ci/common/test.sh
+++ b/ci/common/test.sh
@@ -1,9 +1,12 @@
-. "${CI_DIR}/common/suite.sh"
+fail() {
+ local test_name="$1"
+ local message="$2"
-submit_coverage() {
- if [ -n "${GCOV}" ]; then
- "${CI_DIR}/common/submit_coverage.sh" "$@" || echo 'codecov upload failed.'
- fi
+ : "${message:=Test $test_name failed}"
+
+ local full_msg="$test_name :: $message"
+ echo "Failed: $full_msg"
+ exit 1
}
print_core() {
@@ -92,7 +95,6 @@ unittests() {(
if ! ninja -C "${BUILD_DIR}" unittest; then
fail 'unittests' 'Unit tests failed'
fi
- submit_coverage unittest
check_core_dumps "$(command -v luajit)"
)}
@@ -101,7 +103,6 @@ functionaltests() {(
if ! ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}"; then
fail 'functionaltests' 'Functional tests failed'
fi
- submit_coverage functionaltest
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
@@ -113,7 +114,6 @@ oldtests() {(
reset
fail 'oldtests' 'Legacy tests failed'
fi
- submit_coverage oldtest
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
@@ -124,7 +124,7 @@ check_runtime_files() {(
local message="$1" ; shift
local tst="$1" ; shift
- cd runtime
+ cd runtime || exit
for file in $(git ls-files "$@") ; do
# Check that test is not trying to work with files with spaces/etc
# Prefer failing the build over using more robust construct because files
@@ -141,7 +141,6 @@ check_runtime_files() {(
install_nvim() {(
if ! ninja -C "${BUILD_DIR}" install; then
fail 'install' 'make install failed'
- exit 1
fi
"${INSTALL_PREFIX}/bin/nvim" --version
diff --git a/ci/run_tests.sh b/ci/run_tests.sh
index 0d39627dac..f777026ac2 100755
--- a/ci/run_tests.sh
+++ b/ci/run_tests.sh
@@ -6,8 +6,6 @@ set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source-path=SCRIPTDIR
source "${CI_DIR}/common/test.sh"
-# shellcheck source-path=SCRIPTDIR
-source "${CI_DIR}/common/suite.sh"
build_nvim() {
check_core_dumps --delete quiet
@@ -35,8 +33,6 @@ build_nvim() {
cd "${CI_BUILD_DIR}"
}
-rm -f "$END_MARKER"
-
# Run all tests (with some caveats) if no input argument is given
if (($# == 0)); then
tests=('build_nvim')
@@ -55,12 +51,9 @@ else
fi
for i in "${tests[@]}"; do
- eval "$i" || fail "$i"
+ eval "$i" || exit
done
-touch "${END_MARKER}"
-ended_successfully
-
if [[ -s "${GCOV_ERROR_FILE}" ]]; then
echo '=== Unexpected gcov errors: ==='
cat "${GCOV_ERROR_FILE}"
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
index 9d5c793db4..bc395017c0 100644
--- a/cmake.deps/CMakeLists.txt
+++ b/cmake.deps/CMakeLists.txt
@@ -13,10 +13,10 @@ include(CheckCCompilerFlag)
include(Util)
set(DEPS_CMAKE_ARGS
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
- -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
- -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON)
+ -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -D CMAKE_GENERATOR=${CMAKE_GENERATOR}
+ -D CMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
+ -D CMAKE_POSITION_INDEPENDENT_CODE=ON)
set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES})
@@ -24,7 +24,7 @@ set_default_buildtype()
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT isMultiConfig)
- list(APPEND DEPS_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
+ list(APPEND DEPS_CMAKE_ARGS -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-g)
@@ -45,7 +45,7 @@ else()
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
endif()
-list(APPEND DEPS_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR})
+list(APPEND DEPS_CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR})
set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary install directory.")
set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib" CACHE PATH "Dependencies library install directory.")
@@ -141,8 +141,8 @@ endif()
include(ExternalProject)
set_directory_properties(PROPERTIES EP_PREFIX "${DEPS_BUILD_DIR}")
-set(LIBUV_URL https://github.com/libuv/libuv/archive/f610339f74f7f0fcd183533d2c965ce1468b44c6.tar.gz)
-set(LIBUV_SHA256 d5f22303ba44ac60d3232b1977b404d23a349ae4e8cb83f00e7122fafe38d8c9)
+set(LIBUV_URL https://github.com/libuv/libuv/archive/62c2374a8c005ce9e42088965f8f8af2532c177b.tar.gz)
+set(LIBUV_SHA256 c7e89137da65a1cb550ba96b892dfeeabea982bf33b9237bcf9bbcd90f2e70a1)
set(MSGPACK_URL https://github.com/msgpack/msgpack-c/releases/download/c-4.0.0/msgpack-c-4.0.0.tar.gz)
set(MSGPACK_SHA256 420fe35e7572f2a168d17e660ef981a589c9cbe77faa25eb34a520e1fcc032c8)
@@ -167,8 +167,8 @@ set(LIBVTERM_URL https://www.leonerd.org.uk/code/libvterm/libvterm-0.3.1.tar.gz)
set(LIBVTERM_SHA256 25a8ad9c15485368dfd0a8a9dca1aec8fea5c27da3fa74ec518d5d3787f0c397)
set(LUV_VERSION 1.44.2-1)
-set(LUV_URL https://github.com/luvit/luv/archive/80c8c00baebe3e994d1616d4b54097c2d6e14834.tar.gz)
-set(LUV_SHA256 bcd3ffc7bc80053ab0ec87f0fe83c7632c7619879b2eb75fba88ddb3bee620e8)
+set(LUV_URL https://github.com/luvit/luv/archive/e8e7b7e13225348a8806118a3ea9e021383a9536.tar.gz)
+set(LUV_SHA256 531dfbcb6fffe3fdfa806860b39035e54b07ee1ff3bb2af813e175febf7e9ccc)
set(LUA_COMPAT53_URL https://github.com/keplerproject/lua-compat-5.3/archive/v0.9.tar.gz)
set(LUA_COMPAT53_SHA256 ad05540d2d96a48725bb79a1def35cf6652a4e2ec26376e2617c8ce2baa6f416)
@@ -282,7 +282,7 @@ if (MSVC)
else()
add_custom_target(clean-shared-libraries
COMMAND ${CMAKE_COMMAND}
- -DREMOVE_FILE_GLOB=${DEPS_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}*${CMAKE_SHARED_LIBRARY_SUFFIX}*
+ -D REMOVE_FILE_GLOB=${DEPS_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}*${CMAKE_SHARED_LIBRARY_SUFFIX}*
-P ${PROJECT_SOURCE_DIR}/cmake/RemoveFiles.cmake
DEPENDS ${THIRD_PARTY_DEPS}
)
diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake
index 1f9fd38702..31d84b76e4 100644
--- a/cmake.deps/cmake/BuildGettext.cmake
+++ b/cmake.deps/cmake/BuildGettext.cmake
@@ -11,8 +11,8 @@ if(MSVC)
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
- -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
- -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$<SEMICOLON>${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}
+ -D LIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
+ -D LIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$<SEMICOLON>${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
else()
message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
diff --git a/cmake.deps/cmake/BuildLibtermkey.cmake b/cmake.deps/cmake/BuildLibtermkey.cmake
index 6457a864ba..5836b05494 100644
--- a/cmake.deps/cmake/BuildLibtermkey.cmake
+++ b/cmake.deps/cmake/BuildLibtermkey.cmake
@@ -10,9 +10,9 @@ ExternalProject_Add(libtermkey
${CMAKE_CURRENT_SOURCE_DIR}/cmake/libtermkeyCMakeLists.txt
${DEPS_BUILD_DIR}/src/libtermkey/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
- -DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="" # Hack to avoid -rdynamic in Mingw
- -DUNIBILIUM_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
- -DUNIBILIUM_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}
+ -D CMAKE_SHARED_LIBRARY_LINK_C_FLAGS="" # Hack to avoid -rdynamic in Mingw
+ -D UNIBILIUM_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
+ -D UNIBILIUM_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
list(APPEND THIRD_PARTY_DEPS libtermkey)
diff --git a/cmake.deps/cmake/BuildLibuv.cmake b/cmake.deps/cmake/BuildLibuv.cmake
index eb88458644..6b3c8643a0 100644
--- a/cmake.deps/cmake/BuildLibuv.cmake
+++ b/cmake.deps/cmake/BuildLibuv.cmake
@@ -7,9 +7,9 @@ ExternalProject_Add(libuv
DOWNLOAD_NO_PROGRESS TRUE
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
- -DCMAKE_INSTALL_LIBDIR=lib
- -DBUILD_TESTING=OFF
- -DLIBUV_BUILD_SHARED=OFF
+ -D CMAKE_INSTALL_LIBDIR=lib
+ -D BUILD_TESTING=OFF
+ -D LIBUV_BUILD_SHARED=OFF
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
list(APPEND THIRD_PARTY_DEPS libuv)
diff --git a/cmake.deps/cmake/BuildLuv.cmake b/cmake.deps/cmake/BuildLuv.cmake
index 38c0503c5b..155d6ced4e 100644
--- a/cmake.deps/cmake/BuildLuv.cmake
+++ b/cmake.deps/cmake/BuildLuv.cmake
@@ -2,37 +2,37 @@ set(LUV_INCLUDE_FLAGS
"-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1")
set(LUV_CMAKE_ARGS
- -DLUA_BUILD_TYPE=System
- -DLUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3
- -DWITH_SHARED_LIBUV=ON
- -DBUILD_SHARED_LIBS=OFF
- -DBUILD_STATIC_LIBS=ON
- -DBUILD_MODULE=OFF)
+ -D LUA_BUILD_TYPE=System
+ -D LUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3
+ -D WITH_SHARED_LIBUV=ON
+ -D BUILD_SHARED_LIBS=OFF
+ -D BUILD_STATIC_LIBS=ON
+ -D BUILD_MODULE=OFF)
if(USE_BUNDLED_LUAJIT)
- list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=LuaJit)
+ list(APPEND LUV_CMAKE_ARGS -D WITH_LUA_ENGINE=LuaJit)
elseif(USE_BUNDLED_LUA)
- list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=Lua)
+ list(APPEND LUV_CMAKE_ARGS -D WITH_LUA_ENGINE=Lua)
else()
find_package(LuaJit)
if(LUAJIT_FOUND)
- list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=LuaJit)
+ list(APPEND LUV_CMAKE_ARGS -D WITH_LUA_ENGINE=LuaJit)
else()
- list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=Lua)
+ list(APPEND LUV_CMAKE_ARGS -D WITH_LUA_ENGINE=Lua)
endif()
endif()
if(USE_BUNDLED_LIBUV)
list(APPEND LUV_CMAKE_ARGS
- -DCMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR}
- -DLIBUV_LIBRARIES=uv_a)
+ -D CMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR}
+ -D LIBUV_LIBRARIES=uv_a)
endif()
list(APPEND LUV_CMAKE_ARGS
"-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS}")
if(CMAKE_GENERATOR MATCHES "Unix Makefiles" AND
(CMAKE_SYSTEM_NAME MATCHES ".*BSD" OR CMAKE_SYSTEM_NAME MATCHES "DragonFly"))
- list(APPEND LUV_CMAKE_ARGS -DCMAKE_MAKE_PROGRAM=gmake)
+ list(APPEND LUV_CMAKE_ARGS -D CMAKE_MAKE_PROGRAM=gmake)
endif()
if(USE_EXISTING_SRC_DIR)
diff --git a/cmake.deps/cmake/BuildMsgpack.cmake b/cmake.deps/cmake/BuildMsgpack.cmake
index 431420fb62..b1a77ee835 100644
--- a/cmake.deps/cmake/BuildMsgpack.cmake
+++ b/cmake.deps/cmake/BuildMsgpack.cmake
@@ -7,8 +7,8 @@ ExternalProject_Add(msgpack
DOWNLOAD_NO_PROGRESS TRUE
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
- -DMSGPACK_BUILD_TESTS=OFF
- -DMSGPACK_BUILD_EXAMPLES=OFF
+ -D MSGPACK_BUILD_TESTS=OFF
+ -D MSGPACK_BUILD_EXAMPLES=OFF
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
list(APPEND THIRD_PARTY_DEPS msgpack)
diff --git a/cmake.deps/cmake/BuildTreesitterParsers.cmake b/cmake.deps/cmake/BuildTreesitterParsers.cmake
index d62b19d97d..fcfcb71036 100644
--- a/cmake.deps/cmake/BuildTreesitterParsers.cmake
+++ b/cmake.deps/cmake/BuildTreesitterParsers.cmake
@@ -12,7 +12,7 @@ function(BuildTSParser LANG TS_URL TS_SHA256 TS_CMAKE_FILE)
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE}
${DEPS_BUILD_DIR}/src/${NAME}/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
- -DPARSERLANG=${LANG}
+ -D PARSERLANG=${LANG}
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
endfunction()
diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake
index d6c4e9cbef..e4946bee3f 100644
--- a/cmake/FindLibUV.cmake
+++ b/cmake/FindLibUV.cmake
@@ -13,7 +13,7 @@ endif()
find_path(LIBUV_INCLUDE_DIR uv.h
HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS})
-list(APPEND LIBUV_NAMES uv_a uv)
+list(APPEND LIBUV_NAMES uv_a uv libuv)
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS})
diff --git a/cmake/WindowsDllCopy.cmake b/cmake/WindowsDllCopy.cmake
index fbbabf3a0c..c07dc51b8a 100644
--- a/cmake/WindowsDllCopy.cmake
+++ b/cmake/WindowsDllCopy.cmake
@@ -6,13 +6,13 @@
# - CMAKE_PREFIX_PATH: A list of directories to search for dependencies
if(NOT DEFINED BINARY)
- message(FATAL_ERROR "Missing required argument -DBINARY=")
+ message(FATAL_ERROR "Missing required argument -D BINARY=")
endif()
if(NOT DEFINED DST)
- message(FATAL_ERROR "Missing required arguments -DDST=")
+ message(FATAL_ERROR "Missing required arguments -D DST=")
endif()
if(NOT DEFINED CMAKE_PREFIX_PATH)
- message(FATAL_ERROR "Missing required arguments -DCMAKE_PREFIX_PATH=")
+ message(FATAL_ERROR "Missing required arguments -D CMAKE_PREFIX_PATH=")
endif()
include(GetPrerequisites)
diff --git a/codecov.yml b/codecov.yml
deleted file mode 100644
index a83fd916ee..0000000000
--- a/codecov.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-# To validate:
-# cat codecov.yml | curl --data-binary @- https://codecov.io/validate
-
-codecov:
- notify:
- require_ci_to_pass: no
- ci:
- - appveyor
- - travis
- - !neovim-qb.szakmeister.net
-
-coverage:
- precision: 2
- round: down
- range: "70...100"
-
- status:
- project:
- default:
- threshold: 1
- patch:
- default:
- threshold: 1
- only_pulls: true
- changes: no
-
-comment: off
diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt
index 86f4163f4d..66cee0649c 100644
--- a/runtime/doc/luvref.txt
+++ b/runtime/doc/luvref.txt
@@ -24,7 +24,7 @@ be used in other Lua environments.
More information about the core libuv library can be found at the original
libuv documentation page (https://docs.libuv.org/).
-TCP Echo Server Example~
+TCP Echo Server Example ~
Here is a small example showing a TCP echo server:
@@ -51,15 +51,15 @@ Here is a small example showing a TCP echo server:
uv.run() -- an explicit run call is necessary outside of luvit
<
-Module Layout~
+Module Layout ~
The luv library contains a single Lua module referred to hereafter as `uv` for
simplicity. This module consists mostly of functions with names corresponding
to their original libuv versions. For example, the libuv function
-`uv_tcp_bind` has a luv version at |uv.tcp_bind()|. Currently, only one
-non-function field exists: `uv.constants`, which is a table.
+`uv_tcp_bind` has a luv version at |uv.tcp_bind()|. Currently, only two
+non-function fields exists: `uv.constants` and `uv.errno`, which are tables.
-Functions vs Methods~
+Functions vs Methods ~
In addition to having simple functions, luv provides an optional method-style
API. For example, `uv.tcp_bind(server, host, port)` can alternatively be
@@ -67,7 +67,7 @@ called as `server:bind(host, port)` . Note that the first argument `server`
becomes the object and `tcp_` is removed from the function name. Method forms
are documented below where they exist.
-Synchronous vs Asynchronous Functions~
+Synchronous vs Asynchronous Functions ~
Functions that accept a callback are asynchronous. These functions may
immediately return results to the caller to indicate their initial status, but
@@ -82,7 +82,7 @@ Some (generally FS and DNS) functions can behave either synchronously or
asynchronously. If a callback is provided to these functions, they behave
asynchronously; if no callback is provided, they behave synchronously.
-Pseudo-Types~
+Pseudo-Types ~
Some unique types are defined. These are not actual types in Lua, but they are
used here to facilitate documenting consistent behavior:
@@ -133,10 +133,10 @@ module.
==============================================================================
ERROR HANDLING *luv-error-handling*
-In libuv, errors are negative numbered constants; however, these errors and
-the functions used to handle them are not exposed to luv users. Instead, if an
-internal error is encountered, the luv function will return to the caller an
-assertable `nil, err, name` tuple.
+In libuv, errors are negative numbered constants; however, while those errors
+are exposed through `uv.errno`, the functions used to handle them are not
+exposed to luv users. Instead, if an internal error is encountered, the luv
+function will return to the caller an assertable `nil, err, name` tuple.
- `nil` idiomatically indicates failure
- `err` is a string with the format `{name}: {message}`
@@ -151,6 +151,94 @@ When a function is called successfully, it will return either a value that is
relevant to the operation of the function, or the integer `0` to indicate
success, or sometimes nothing at all. These cases are documented below.
+`uv.errno` *uv.errno*
+
+A table value which exposes error constants as a map, where the key is the
+error name (without the `UV_` prefix) and its value is a negative number.
+See Libuv's "Error constants" page for further details.
+(https://docs.libuv.org/en/v1.x/errors.html#error-constants)
+
+- `E2BIG`: argument list too long.
+- `EACCES`: permission denied.
+- `EADDRINUSE`: address already in use.
+- `EADDRNOTAVAIL`: address not available.
+- `EAFNOSUPPORT`: address family not supported.
+- `EAGAIN`: resource temporarily unavailable.
+- `EAI_ADDRFAMILY`: address family not supported.
+- `EAI_AGAIN`: temporary failure.
+- `EAI_BADFLAGS`: bad ai_flags value.
+- `EAI_BADHINTS`: invalid value for hints.
+- `EAI_CANCELED`: request canceled.
+- `EAI_FAIL`: permanent failure.
+- `EAI_FAMILY`: ai_family not supported.
+- `EAI_MEMORY`: out of memory.
+- `EAI_NODATA`: no address.
+- `EAI_NONAME`: unknown node or service.
+- `EAI_OVERFLOW`: argument buffer overflow.
+- `EAI_PROTOCOL`: resolved protocol is unknown.
+- `EAI_SERVICE`: service not available for socket type.
+- `EAI_SOCKTYPE`: socket type not supported.
+- `EALREADY`: connection already in progress.
+- `EBADF`: bad file descriptor.
+- `EBUSY`: resource busy or locked.
+- `ECANCELED`: operation canceled.
+- `ECHARSET`: invalid Unicode character.
+- `ECONNABORTED`: software caused connection abort.
+- `ECONNREFUSED`: connection refused.
+- `ECONNRESET`: connection reset by peer.
+- `EDESTADDRREQ`: destination address required.
+- `EEXIST`: file already exists.
+- `EFAULT`: bad address in system call argument.
+- `EFBIG`: file too large.
+- `EHOSTUNREACH`: host is unreachable.
+- `EINTR`: interrupted system call.
+- `EINVAL`: invalid argument.
+- `EIO`: i/o error.
+- `EISCONN`: socket is already connected.
+- `EISDIR`: illegal operation on a directory.
+- `ELOOP`: too many symbolic links encountered.
+- `EMFILE`: too many open files.
+- `EMSGSIZE`: message too long.
+- `ENAMETOOLONG`: name too long.
+- `ENETDOWN`: network is down.
+- `ENETUNREACH`: network is unreachable.
+- `ENFILE`: file table overflow.
+- `ENOBUFS`: no buffer space available.
+- `ENODEV`: no such device.
+- `ENOENT`: no such file or directory.
+- `ENOMEM`: not enough memory.
+- `ENONET`: machine is not on the network.
+- `ENOPROTOOPT`: protocol not available.
+- `ENOSPC`: no space left on device.
+- `ENOSYS`: function not implemented.
+- `ENOTCONN`: socket is not connected.
+- `ENOTDIR`: not a directory.
+- `ENOTEMPTY`: directory not empty.
+- `ENOTSOCK`: socket operation on non-socket.
+- `ENOTSUP`: operation not supported on socket.
+- `EOVERFLOW`: value too large for defined data type.
+- `EPERM`: operation not permitted.
+- `EPIPE`: broken pipe.
+- `EPROTO`: protocol error.
+- `EPROTONOSUPPORT`: protocol not supported.
+- `EPROTOTYPE`: protocol wrong type for socket.
+- `ERANGE`: result too large.
+- `EROFS`: read-only file system.
+- `ESHUTDOWN`: cannot send after transport endpoint shutdown.
+- `ESPIPE`: invalid seek.
+- `ESRCH`: no such process.
+- `ETIMEDOUT`: connection timed out.
+- `ETXTBSY`: text file is busy.
+- `EXDEV`: cross-device link not permitted.
+- `UNKNOWN`: unknown error.
+- `EOF`: end of file.
+- `ENXIO`: no such device or address.
+- `EMLINK`: too many links.
+- `ENOTTY`: inappropriate ioctl for device.
+- `EFTYPE`: inappropriate file type or format.
+- `EILSEQ`: illegal byte sequence.
+- `ESOCKTNOSUPPORT`: socket type not supported.
+
==============================================================================
VERSION CHECKING *luv-version-checking*
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 1f91b89322..17f1c822ff 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4765,7 +4765,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Flags to change the way redrawing works, for debugging purposes.
Most useful with 'writedelay' set to some reasonable value.
Supports the following flags:
- compositor Indicate what redraws come from the compositor
+ compositor Indicate each redraw event handled by the compositor
by briefly flashing the redrawn regions in colors
indicating the redraw type. These are the highlight
groups used (and their default colors):
@@ -4777,6 +4777,11 @@ A jump table for the options with a short description can be found at |Q_op|.
RedrawDebugRecompose guibg=Red redraw generated by the
compositor itself, due to a
grid being moved or deleted.
+ line introduce a delay after each line drawn on the screen.
+ When using the TUI or another single-grid UI, "compositor"
+ gives more information and should be preferred (every
+ line is processed as a separate event by the compositor)
+ flush introduce a delay after each "flush" event.
nothrottle Turn off throttling of the message grid. This is an
optimization that joins many small scrolls to one
larger scroll when drawing the message area (with
@@ -4786,7 +4791,7 @@ A jump table for the options with a short description can be found at |Q_op|.
useful when running nvim inside a debugger (and
the test suite).
nodelta Send all internally redrawn cells to the UI, even if
- they are unchanged from the already displayed state.
+ they are unchanged from the already displayed state.
*'redrawtime'* *'rdt'*
'redrawtime' 'rdt' number (default 2000)
@@ -7372,8 +7377,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'writedelay'* *'wd'*
'writedelay' 'wd' number (default 0)
global
- The number of milliseconds to wait for each character sent to the
- screen. When positive, characters are sent to the UI one by one.
- See 'redrawdebug' for more options. For debugging purposes.
+ Only takes effect toghether with 'redrawdebug'.
+ The number of milliseconds to wait after each line or each flush
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index fd1c3c28db..52bafffefe 100755
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -135,8 +135,7 @@ if(MINGW)
target_compile_definitions(main_lib INTERFACE __USE_MINGW_ANSI_STDIO)
endif()
if(WIN32)
- # Windows Vista is the minimum supported version
- target_compile_definitions(main_lib INTERFACE _WIN32_WINNT=0x0600 MSWIN)
+ target_compile_definitions(main_lib INTERFACE _WIN32_WINNT=0x0602 MSWIN)
endif()
# OpenBSD's GCC (4.2.1) doesn't have -Wvla
@@ -449,12 +448,12 @@ set(gen_cflags ${gen_cflags} -O2)
set(NVIM_VERSION_GIT_H ${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef_git.h)
add_custom_target(update_version_stamp
COMMAND ${CMAKE_COMMAND}
- -DNVIM_VERSION_MAJOR=${NVIM_VERSION_MAJOR}
- -DNVIM_VERSION_MINOR=${NVIM_VERSION_MINOR}
- -DNVIM_VERSION_PATCH=${NVIM_VERSION_PATCH}
- -DNVIM_VERSION_PRERELEASE=${NVIM_VERSION_PRERELEASE}
- -DOUTPUT=${NVIM_VERSION_GIT_H}
- -DNVIM_SOURCE_DIR=${CMAKE_SOURCE_DIR}
+ -D NVIM_VERSION_MAJOR=${NVIM_VERSION_MAJOR}
+ -D NVIM_VERSION_MINOR=${NVIM_VERSION_MINOR}
+ -D NVIM_VERSION_PATCH=${NVIM_VERSION_PATCH}
+ -D NVIM_VERSION_PRERELEASE=${NVIM_VERSION_PRERELEASE}
+ -D OUTPUT=${NVIM_VERSION_GIT_H}
+ -D NVIM_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${PROJECT_SOURCE_DIR}/cmake/GenerateVersion.cmake
BYPRODUCTS ${NVIM_VERSION_GIT_H})
@@ -665,9 +664,14 @@ else()
target_compile_definitions(nvim PRIVATE $<$<CONFIG:Debug>:UNIT_TESTING>)
endif()
-target_sources(nvim PRIVATE ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS}
- ${NVIM_GENERATED_SOURCES} ${NVIM_SOURCES} ${NVIM_HEADERS}
- ${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS})
+target_sources(main_lib INTERFACE
+ ${NVIM_GENERATED_FOR_SOURCES}
+ ${NVIM_GENERATED_FOR_HEADERS}
+ ${NVIM_GENERATED_SOURCES}
+ ${NVIM_SOURCES}
+ ${NVIM_HEADERS}
+ ${EXTERNAL_SOURCES}
+ ${EXTERNAL_HEADERS})
set_target_properties(nvim
PROPERTIES
@@ -706,9 +710,9 @@ if(WIN32)
add_custom_target(nvim_dll_deps DEPENDS nvim
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps
COMMAND ${CMAKE_COMMAND}
- "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
- -DBINARY="${PROJECT_BINARY_DIR}/bin/nvim${CMAKE_EXECUTABLE_SUFFIX}"
- -DDST=${PROJECT_BINARY_DIR}/windows_runtime_deps
+ -D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
+ -D BINARY="${PROJECT_BINARY_DIR}/bin/nvim${CMAKE_EXECUTABLE_SUFFIX}"
+ -D DST=${PROJECT_BINARY_DIR}/windows_runtime_deps
-P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake)
add_dependencies(nvim_runtime_deps nvim_dll_deps)
@@ -810,14 +814,7 @@ install(DIRECTORY ${BINARY_LIB_DIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/nvim/
USE_SOURCE_PERMISSIONS)
-add_library(
- libnvim
- STATIC
- EXCLUDE_FROM_ALL
- ${NVIM_SOURCES} ${NVIM_GENERATED_SOURCES}
- ${NVIM_HEADERS} ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS}
- ${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS}
-)
+add_library(libnvim STATIC EXCLUDE_FROM_ALL)
if(MSVC)
set(LIBNVIM_NAME libnvim)
else()
@@ -860,63 +857,35 @@ elseif(CLANG_TSAN)
target_link_libraries(nvim PRIVATE -fsanitize=thread)
endif()
-function(get_test_target prefix sfile relative_path_var target_var)
- get_filename_component(full_d "${sfile}" DIRECTORY)
- file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
- if(d MATCHES "^[.][.]")
- file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
- endif()
- get_filename_component(r "${sfile}" NAME)
- if(NOT d MATCHES "^[.]?$")
- set(r "${d}/${r}")
- endif()
- string(REGEX REPLACE "[/.]" "-" suffix "${r}")
- set(${relative_path_var} ${r} PARENT_SCOPE)
- if(prefix STREQUAL "")
- set(${target_var} "${suffix}" PARENT_SCOPE)
- else()
- set(${target_var} "${prefix}-${suffix}" PARENT_SCOPE)
- endif()
-endfunction()
-
+find_program(CLANG_TIDY_PRG clang-tidy)
+set(EXCLUDE_CLANG_TIDY typval_encode.c.h ui_events.in.h)
if(WIN32)
- set(NO_SINGLE_CHECK_HEADERS
+ list(APPEND EXCLUDE_CLANG_TIDY
os/pty_process_unix.h
os/unix_defs.h)
else()
- set(NO_SINGLE_CHECK_HEADERS
+ list(APPEND EXCLUDE_CLANG_TIDY
os/win_defs.h
os/pty_process_win.h
os/pty_conpty_win.h
os/os_win_console.h)
endif()
-foreach(hfile ${NVIM_HEADERS})
- get_test_target(test-includes "${hfile}" relative_path texe)
-
- if(NOT ${hfile} MATCHES "[.](c|in)[.]h$")
- set(tsource "${GENERATED_DIR}/${relative_path}.test-include.c")
- write_file("${tsource}" "#include \"${hfile}\"\nint main(int argc, char **argv) { return 0; }")
- add_executable(
- ${texe}
- EXCLUDE_FROM_ALL
- ${tsource} ${NVIM_HEADERS} ${NVIM_GENERATED_FOR_HEADERS})
- target_link_libraries(${texe} PRIVATE main_lib)
- set_target_properties(${texe} PROPERTIES FOLDER test)
-
- list(FIND NO_SINGLE_CHECK_HEADERS "${relative_path}" hfile_exclude_idx)
- if(${hfile_exclude_idx} EQUAL -1)
- list(APPEND HEADER_CHECK_TARGETS ${texe})
- endif()
- endif()
-endforeach()
-add_custom_target(check-single-includes DEPENDS ${HEADER_CHECK_TARGETS})
+add_glob_target(
+ TARGET clang-tidy
+ COMMAND ${CLANG_TIDY_PRG}
+ FILES ${NVIM_SOURCES} ${NVIM_HEADERS}
+ FLAGS --quiet
+ EXCLUDE ${EXCLUDE_CLANG_TIDY})
+add_custom_target(copy_compile_commands
+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/compile_commands.json ${PROJECT_SOURCE_DIR}/compile_commands.json)
+add_dependencies(copy_compile_commands nvim)
+add_dependencies(clang-tidy copy_compile_commands)
if(CI_BUILD)
set(LINT_OUTPUT_FORMAT gh_action)
else()
set(LINT_OUTPUT_FORMAT vs7)
endif()
-
add_glob_target(
TARGET lintc-clint
COMMAND ${PROJECT_SOURCE_DIR}/src/clint.py
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index e67607a7e4..3ad625234c 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -202,6 +202,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, Dictiona
data->flushed_events = false;
data->ncalls_pos = NULL;
data->ncalls = 0;
+ data->ncells_pending = 0;
data->buf_wptr = data->buf;
data->temp_buf = NULL;
data->wildmenu_active = false;
@@ -854,18 +855,25 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
mpack_uint(buf, repeat);
}
}
+ data->ncells_pending += MIN(repeat, 2);
last_hl = attrs[i];
repeat = 0;
}
}
if (endcol < clearcol) {
nelem++;
+ data->ncells_pending += 1;
mpack_array(buf, 3);
mpack_str(buf, " ");
mpack_uint(buf, (uint32_t)clearattr);
mpack_uint(buf, (uint32_t)(clearcol - endcol));
}
mpack_w2(&lenpos, nelem);
+
+ if (data->ncells_pending > 500) {
+ // pass of cells to UI to let it start processing them
+ remote_ui_flush_buf(ui);
+ }
} else {
for (int i = 0; i < endcol - startcol; i++) {
remote_ui_cursor_goto(ui, row, startcol + i);
@@ -917,6 +925,8 @@ void remote_ui_flush_buf(UI *ui)
// we have sent events to the client, but possibly not yet the final "flush"
// event.
data->flushed_events = true;
+
+ data->ncells_pending = 0;
}
/// An intentional flush (vsync) when Nvim is finished redrawing the screen
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index d60e18590f..34c8f89e3f 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -247,10 +247,13 @@ static void parse_msgpack(Channel *channel)
Unpacker *p = channel->rpc.unpacker;
while (unpacker_advance(p)) {
if (p->type == kMessageTypeRedrawEvent) {
- if (p->grid_line_event) {
- ui_client_event_raw_line(p->grid_line_event);
- } else if (p->ui_handler.fn != NULL && p->result.type == kObjectTypeArray) {
- p->ui_handler.fn(p->result.data.array);
+ // When exiting, ui_client_stop() has already been called, so don't handle UI events.
+ if (ui_client_channel_id && !exiting) {
+ if (p->grid_line_event) {
+ ui_client_event_raw_line(p->grid_line_event);
+ } else if (p->ui_handler.fn != NULL && p->result.type == kObjectTypeArray) {
+ p->ui_handler.fn(p->result.data.array);
+ }
}
arena_mem_free(arena_finish(&p->arena));
} else if (p->type == kMessageTypeResponse) {
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index d190fc5999..0e0cc4c983 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -630,6 +630,8 @@ EXTERN unsigned rdb_flags;
#define RDB_NOTHROTTLE 0x002
#define RDB_INVALID 0x004
#define RDB_NODELTA 0x008
+#define RDB_LINE 0x010
+#define RDB_FLUSH 0x020
EXTERN long p_rdt; // 'redrawtime'
EXTERN long p_re; // 'regexpengine'
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 901477d869..7efbeadb2f 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -125,7 +125,8 @@ static char *(p_spo_values[]) = { "camel", "noplainbuffer", NULL };
static char *(p_icm_values[]) = { "nosplit", "split", NULL };
static char *(p_jop_values[]) = { "stack", "view", NULL };
static char *(p_tpf_values[]) = { "BS", "HT", "FF", "ESC", "DEL", "C0", "C1", NULL };
-static char *(p_rdb_values[]) = { "compositor", "nothrottle", "invalid", "nodelta", NULL };
+static char *(p_rdb_values[]) = { "compositor", "nothrottle", "invalid", "nodelta", "line",
+ "flush", NULL };
static char *(p_sloc_values[]) = { "last", "statusline", "tabline", NULL };
/// All possible flags for 'shm'.
diff --git a/src/nvim/po/CMakeLists.txt b/src/nvim/po/CMakeLists.txt
index 1db21880bb..a5a3c135d3 100644
--- a/src/nvim/po/CMakeLists.txt
+++ b/src/nvim/po/CMakeLists.txt
@@ -100,12 +100,12 @@ if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG)
add_custom_target(update-po-${lang}
COMMAND ${CMAKE_COMMAND}
- -DICONV_PRG=${ICONV_PRG}
- -DINPUT_FILE=${inputFile}
- -DOUTPUT_FILE=${outputFile}
- -DINPUT_ENC=${inputEnc}
- -DOUTPUT_ENC=${outputEnc}
- -DOUTPUT_CHARSET=${outputCharSet}
+ -D ICONV_PRG=${ICONV_PRG}
+ -D INPUT_FILE=${inputFile}
+ -D OUTPUT_FILE=${outputFile}
+ -D INPUT_ENC=${inputEnc}
+ -D OUTPUT_ENC=${outputEnc}
+ -D OUTPUT_CHARSET=${outputCharSet}
-P ${PROJECT_SOURCE_DIR}/cmake/ConvertPo.cmake
COMMENT "Updating ${outputName}.po"
DEPENDS ${inputFile})
diff --git a/src/nvim/testdir/runnvim.sh b/src/nvim/testdir/runnvim.sh
index 3a0a94b6bf..4d8ea0527d 100755
--- a/src/nvim/testdir/runnvim.sh
+++ b/src/nvim/testdir/runnvim.sh
@@ -22,13 +22,11 @@ main() {(
i=$(( i+1 ))
done
- export CI_DIR="$root/ci"
BUILD_DIR="$(dirname "$nvim_prg")/.."
export BUILD_DIR
export FAILED=0
- . "$CI_DIR/common/suite.sh"
- . "$CI_DIR/common/test.sh"
+ . $(dirname $0)/test.sh
# Redirect XDG_CONFIG_HOME so users local config doesn't interfere
export XDG_CONFIG_HOME="$root"
diff --git a/src/nvim/testdir/suite.sh b/src/nvim/testdir/suite.sh
new file mode 100644
index 0000000000..bf5a16fd89
--- /dev/null
+++ b/src/nvim/testdir/suite.sh
@@ -0,0 +1,10 @@
+fail() {
+ local test_name="$1"
+ local message="$2"
+
+ : "${message:=Test $test_name failed}"
+
+ local full_msg="$test_name :: $message"
+ echo "Failed: $full_msg"
+ export FAILED=1
+}
diff --git a/src/nvim/testdir/test.sh b/src/nvim/testdir/test.sh
new file mode 100644
index 0000000000..affdc308d1
--- /dev/null
+++ b/src/nvim/testdir/test.sh
@@ -0,0 +1,91 @@
+fail() {
+ local test_name="$1"
+ local message="$2"
+
+ : "${message:=Test $test_name failed}"
+
+ local full_msg="$test_name :: $message"
+ echo "Failed: $full_msg"
+ export FAILED=1
+}
+
+print_core() {
+ local app="$1"
+ local core="$2"
+ if test "$app" = quiet ; then
+ echo "Found core $core"
+ return 0
+ fi
+ echo "======= Core file $core ======="
+ if test "${CI_OS_NAME}" = osx ; then
+ lldb -Q -o "bt all" -f "${app}" -c "${core}"
+ else
+ gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}"
+ fi
+}
+
+check_core_dumps() {
+ local del=
+ if test "$1" = "--delete" ; then
+ del=1
+ shift
+ fi
+ local app="${1:-${BUILD_DIR}/bin/nvim}"
+ local cores
+ if test "${CI_OS_NAME}" = osx ; then
+ cores="$(find /cores/ -type f -print)"
+ local _sudo='sudo'
+ else
+ cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)"
+ local _sudo=
+ fi
+
+ if test -z "${cores}" ; then
+ return
+ fi
+ local core
+ for core in $cores; do
+ if test "$del" = "1" ; then
+ print_core "$app" "$core" >&2
+ "$_sudo" rm "$core"
+ else
+ print_core "$app" "$core"
+ fi
+ done
+ if test "$app" != quiet ; then
+ fail 'cores' 'Core dumps found'
+ fi
+}
+
+check_logs() {
+ # Iterate through each log to remove an useless warning.
+ # shellcheck disable=SC2044
+ for log in $(find "${1}" -type f -name "${2}"); do
+ sed -i "${log}" \
+ -e '/Warning: noted but unhandled ioctl/d' \
+ -e '/could cause spurious value errors to appear/d' \
+ -e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
+ done
+
+ # Now do it again, but only consider files with size > 0.
+ local err=""
+ # shellcheck disable=SC2044
+ for log in $(find "${1}" -type f -name "${2}" -size +0); do
+ cat "${log}"
+ err=1
+ rm "${log}"
+ done
+ if test -n "${err}" ; then
+ fail 'logs' 'Runtime errors detected.'
+ fi
+}
+
+valgrind_check() {
+ check_logs "${1}" "valgrind-*"
+}
+
+check_sanitizer() {
+ if test -n "${CLANG_SANITIZER}"; then
+ check_logs "${1}" "*san.*" | cat
+ fi
+}
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 9f1cb87eb0..b22dc4a661 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -419,7 +419,7 @@ void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol,
(const sattr_T *)grid->attrs + off);
// 'writedelay': flush & delay each time.
- if (p_wd && !(rdb_flags & RDB_COMPOSITOR)) {
+ if (p_wd && (rdb_flags & RDB_LINE)) {
// If 'writedelay' is active, set the cursor to indicate what was drawn.
ui_call_grid_cursor_goto(grid->handle, row,
MIN(clearcol, (int)grid->cols - 1));
@@ -510,6 +510,10 @@ void ui_flush(void)
pending_has_mouse = has_mouse;
}
ui_call_flush();
+
+ if (p_wd && (rdb_flags & RDB_FLUSH)) {
+ os_microdelay((uint64_t)labs(p_wd) * 1000U, true);
+ }
}
/// Check if 'mouse' is active for the current mode
diff --git a/src/nvim/ui.h b/src/nvim/ui.h
index 9140a9f1f3..e83f93eb07 100644
--- a/src/nvim/ui.h
+++ b/src/nvim/ui.h
@@ -79,6 +79,8 @@ typedef struct {
uint32_t ncalls; ///< number of calls made to the current event (plus one for the name!)
bool flushed_events; ///< events where sent to client without "flush" event
+ size_t ncells_pending; ///< total number of cells since last buffer flush
+
int hl_id; // Current highlight for legacy put event.
Integer cursor_row, cursor_col; // Intended visible cursor position.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000000..7e5fb07382
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,91 @@
+add_subdirectory(functional/fixtures) # compile test programs
+get_directory_property(GENERATED_HELP_TAGS DIRECTORY ${PROJECT_SOURCE_DIR}/runtime DEFINITION GENERATED_HELP_TAGS)
+
+if(NOT BUSTED_OUTPUT_TYPE)
+ set(BUSTED_OUTPUT_TYPE "nvim")
+endif()
+
+find_program(BUSTED_PRG NAMES busted busted.bat)
+if(BUSTED_PRG)
+ get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES)
+
+ set(UNITTEST_PREREQS nvim)
+ set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test pwsh-test streams-test tty-test ${GENERATED_HELP_TAGS})
+ set(BENCHMARK_PREREQS nvim tty-test)
+
+ check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
+ if(LUA_HAS_FFI)
+ add_custom_target(unittest
+ COMMAND ${CMAKE_COMMAND}
+ -D BUSTED_PRG=${BUSTED_PRG}
+ -D LUA_PRG=${LUA_PRG}
+ -D NVIM_PRG=$<TARGET_FILE:nvim>
+ -D WORKING_DIR=${PROJECT_SOURCE_DIR}
+ -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
+ -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -D BUILD_DIR=${CMAKE_BINARY_DIR}
+ -D TEST_TYPE=unit
+ -D CIRRUS_CI=$ENV{CIRRUS_CI}
+ -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
+ DEPENDS ${UNITTEST_PREREQS}
+ USES_TERMINAL)
+ set_target_properties(unittest PROPERTIES FOLDER test)
+ else()
+ message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
+ endif()
+
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/test/cmakeconfig/paths.lua.in
+ ${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua)
+
+ add_custom_target(functionaltest
+ COMMAND ${CMAKE_COMMAND}
+ -D BUSTED_PRG=${BUSTED_PRG}
+ -D LUA_PRG=${LUA_PRG}
+ -D NVIM_PRG=$<TARGET_FILE:nvim>
+ -D WORKING_DIR=${PROJECT_SOURCE_DIR}
+ -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
+ -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -D BUILD_DIR=${CMAKE_BINARY_DIR}
+ -D TEST_TYPE=functional
+ -D CIRRUS_CI=$ENV{CIRRUS_CI}
+ -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
+ DEPENDS ${FUNCTIONALTEST_PREREQS}
+ USES_TERMINAL)
+ set_target_properties(functionaltest PROPERTIES FOLDER test)
+
+ add_custom_target(benchmark
+ COMMAND ${CMAKE_COMMAND}
+ -D BUSTED_PRG=${BUSTED_PRG}
+ -D LUA_PRG=${LUA_PRG}
+ -D NVIM_PRG=$<TARGET_FILE:nvim>
+ -D WORKING_DIR=${PROJECT_SOURCE_DIR}
+ -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
+ -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -D BUILD_DIR=${CMAKE_BINARY_DIR}
+ -D TEST_TYPE=benchmark
+ -D CIRRUS_CI=$ENV{CIRRUS_CI}
+ -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
+ DEPENDS ${BENCHMARK_PREREQS}
+ USES_TERMINAL)
+ set_target_properties(benchmark PROPERTIES FOLDER test)
+endif()
+
+find_program(BUSTED_LUA_PRG busted-lua)
+if(BUSTED_LUA_PRG)
+ add_custom_target(functionaltest-lua
+ COMMAND ${CMAKE_COMMAND}
+ -D BUSTED_PRG=${BUSTED_LUA_PRG}
+ -D LUA_PRG=${LUA_PRG}
+ -D NVIM_PRG=$<TARGET_FILE:nvim>
+ -D WORKING_DIR=${PROJECT_SOURCE_DIR}
+ -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
+ -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -D BUILD_DIR=${CMAKE_BINARY_DIR}
+ -D TEST_TYPE=functional
+ -D CIRRUS_CI=$ENV{CIRRUS_CI}
+ -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
+ DEPENDS ${FUNCTIONALTEST_PREREQS}
+ USES_TERMINAL)
+ set_target_properties(functionaltest-lua PROPERTIES FOLDER test)
+endif()
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index ceff390dc5..e6bfc6b64f 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -337,6 +337,21 @@ describe('server -> client', function()
eq('localhost:', string.sub(address,1,10))
connect_test(server, 'tcp', address)
end)
+
+ it('does not crash on receiving UI events', function()
+ local server = spawn(nvim_argv)
+ set_session(server)
+ local address = funcs.serverlist()[1]
+ local client = spawn(nvim_argv, false, nil, true)
+ set_session(client)
+
+ local id = funcs.sockconnect('pipe', address, {rpc=true})
+ funcs.rpcrequest(id, 'nvim_ui_attach', 80, 24, {})
+ assert_alive()
+
+ server:close()
+ client:close()
+ end)
end)
describe('connecting to its own pipe address', function()
diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua
index 05a69e1992..dc4b45b4d9 100644
--- a/test/functional/core/exit_spec.lua
+++ b/test/functional/core/exit_spec.lua
@@ -25,30 +25,34 @@ describe('v:exiting', function()
eq(1, eval('v:exiting is v:null'))
end)
- it('is 0 on normal exit', function()
+ local function test_exiting(setup_fn)
local function on_setup()
- command('autocmd VimLeavePre * call rpcrequest('..cid..', "")')
- command('autocmd VimLeave * call rpcrequest('..cid..', "")')
- command('quit')
+ command('autocmd VimLeavePre * call rpcrequest('..cid..', "exit", "VimLeavePre")')
+ command('autocmd VimLeave * call rpcrequest('..cid..', "exit", "VimLeave")')
+ setup_fn()
end
- local function on_request()
+ local requests_args = {}
+ local function on_request(name, args)
+ eq('exit', name)
+ table.insert(requests_args, args)
eq(0, eval('v:exiting'))
return ''
end
run(on_request, nil, on_setup)
+ eq({{'VimLeavePre'}, {'VimLeave'}}, requests_args)
+ end
+
+ it('is 0 on normal exit', function()
+ test_exiting(function()
+ command('quit')
+ end)
end)
+
it('is 0 on exit from Ex mode involving try-catch vim-patch:8.0.0184', function()
- local function on_setup()
- command('autocmd VimLeavePre * call rpcrequest('..cid..', "")')
- command('autocmd VimLeave * call rpcrequest('..cid..', "")')
+ test_exiting(function()
feed('gQ')
feed_command('try', 'call NoFunction()', 'catch', 'echo "bye"', 'endtry', 'quit')
- end
- local function on_request()
- eq(0, eval('v:exiting'))
- return ''
- end
- run(on_request, nil, on_setup)
+ end)
end)
end)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 1d9e7b8e11..7294969ac8 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -2407,6 +2407,11 @@ describe("TUI as a client", function()
{3:-- TERMINAL --} |
]]}
+ -- No heap-use-after-free when receiving UI events after deadly signal #22184
+ server:request('nvim_input', ('a'):rep(1000))
+ exec_lua([[vim.loop.kill(vim.fn.jobpid(vim.bo.channel), 'sigterm')]])
+ screen:expect({any = '%[Process exited 1%]'})
+
client_super:close()
server:close()
end)