summaryrefslogtreecommitdiffstatshomepage
path: root/test/testutil.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-25ci: ensure full sanitizer logs are shown in CI #39361HEADmasterJustin M. Keyes1
Problem: When ASAN detects an error in a child process, the process may be killed by test teardown before ASAN finishes writing its log file. This results in truncated logs with no stack trace. Also, the sanitizer log content was only written to stdout (which the test runner may not display) and not included in the test_assert error message. Solution: - Poll (up to 2s) for the ASAN "SUMMARY" line before reading, so the crashing process has time to finish writing. - Include full log content in the test_assert error message, so it appears in CI output regardless of stdout handling. - Warn when the log appears truncated (no SUMMARY line found).
2026-04-22ci: drop cirrus #39321Justin M. Keyes1
Problem: cirrus will shutdown soon, and we are running out of minutes anyway, which causes ci failures. Solution: Drop cirrus config.
2026-04-17test: include test path in summary (#39141)zeertzjq1
Ref: https://github.com/neovim/neovim/pull/38486#discussion_r3088483987
2026-04-15test: replace busted with local harnessLewis Russell1
Replace the busted-based Lua test runner with a repo-local harness. The new harness runs spec files directly under `nvim -ll`, ships its own reporter and lightweight `luassert` shim, and keeps the helper/preload flow used by the functional and unit test suites. Keep the file boundary model shallow and busted-like by restoring `_G`, `package.loaded`, `package.preload`, `arg`, and the process environment between files, without carrying extra reset APIs or custom assertion machinery. Update the build and test entrypoints to use the new runner, add black-box coverage for the harness itself, and drop the bundled busted/luacheck dependency path. AI-assisted: Codex
2026-03-29test: fix s390x failuresJustin M. Keyes1
Problem: failures in s390x CI. Solution: - runtime/lua/man.lua: parse_path() can return nil but 3 callers didn't handle it. - skip some tests on s390x. TODO: - TODO: why "build/bin/xxd is not executable" on s390x? - TODO: other failures, not addressed (see below). OTHER FAILURES: FAILED test/functional/treesitter/fold_spec.lua @ 87: treesitter foldexpr recomputes fold levels after lines are added/removed test/functional/treesitter/fold_spec.lua:95: Expected objects to be the same. Passed in: (table: 0x4013c18940) { [1] = '0' [2] = '0' [3] = '0' *[4] = '0' [5] = '0' ... Expected: (table: 0x4005acf900) { [1] = '0' [2] = '0' [3] = '>1' *[4] = '1' [5] = '1' ... stack traceback: (tail call): ? test/functional/treesitter/fold_spec.lua:95: in function <test/functional/treesitter/fold_spec.lua:87> FAILED test/functional/treesitter/select_spec.lua @ 52: treesitter incremental-selection works test/functional/treesitter/select_spec.lua:63: Expected objects to be the same. Passed in: (string) 'bar(2)' Expected: (string) 'foo(1)' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:63: in function <test/functional/treesitter/select_spec.lua:52> FAILED test/functional/treesitter/select_spec.lua @ 69: treesitter incremental-selection repeat test/functional/treesitter/select_spec.lua:82: Expected objects to be the same. Passed in: (string) '2' Expected: (string) '4' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:82: in function <test/functional/treesitter/select_spec.lua:69> FAILED test/functional/treesitter/select_spec.lua @ 98: treesitter incremental-selection history test/functional/treesitter/select_spec.lua:111: Expected objects to be the same. Passed in: (string) 'bar(2)' Expected: (string) 'foo(1)' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:111: in function <test/functional/treesitter/select_spec.lua:98> FAILED test/functional/treesitter/select_spec.lua @ 186: treesitter incremental-selection with injections works test/functional/treesitter/select_spec.lua:201: Expected objects to be the same. Passed in: (string) 'lua' Expected: (string) 'foo' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:201: in function <test/functional/treesitter/select_spec.lua:186> FAILED test/functional/treesitter/select_spec.lua @ 216: treesitter incremental-selection with injections ignores overlapping nodes test/functional/treesitter/select_spec.lua:231: Expected objects to be the same. Passed in: (string) ' )' Expected: (string) ' foo(' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:231: in function <test/functional/treesitter/select_spec.lua:216> FAILED test/functional/treesitter/select_spec.lua @ 307: treesitter incremental-selection with injections handles disjointed trees test/functional/treesitter/select_spec.lua:337: Expected objects to be the same. Passed in: (string) 'int' Expected: (string) '1}' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:337: in function <test/functional/treesitter/select_spec.lua:307> ERROR test/functional/treesitter/parser_spec.lua @ 562: treesitter parser API can run async parses with string parsers test/functional/treesitter/parser_spec.lua:565: attempt to index a nil value stack traceback: test/functional/testnvim/exec_lua.lua:124: in function <test/functional/testnvim/exec_lua.lua:105> (tail call): ? (tail call): ? test/functional/treesitter/parser_spec.lua:563: in function <test/functional/treesitter/parser_spec.lua:562> FAILED test/functional/core/job_spec.lua @ 1157: jobs jobstop() kills entire process tree #6530 test/functional/core/job_spec.lua:1244: retry() attempts: 94 test/functional/core/job_spec.lua:1246: Expected objects to be the same. Passed in: (table: 0x401dd74b30) { [name] = 'sleep <defunct>' [pid] = 33579 [ppid] = 1 } Expected: (userdata) 'vim.NIL' stack traceback: test/testutil.lua:89: in function 'retry' test/functional/core/job_spec.lua:1244: in function <test/functional/core/job_spec.lua:1157>
2026-03-12test: fs_spec fails if home is a symlink #38258Willaaaaaaa1
2026-02-18feat(logging): rename ".nvimlog" => "nvim.log" #37935Justin M. Keyes1
- Rename ".nvimlog" to "nvim.log" - doesn't need to be "hidden"/dotfile - ".log" extension helps with filetype detection - Also rename "nvim/log" => "nvim/nvim.log"
2026-02-12fix(terminal): changing height may lead to wrong scrollback (#37824)zeertzjq1
Problem: Changing terminal height immediately after outputting lines may lead to wrong scrollback. Solution: Insert pending scrollback lines before the old window height.
2026-01-21test: fix some type warnings (#37483)zeertzjq1
2025-05-22fix(tests): use uv.spawn instead of io.popen for unittest helpersbfredl1
The old implementation of repeated_read_cmd would attempt to run the command multiple times to handle racyness of async output. Code like this should not be written. Instead, use the libuv event loop to read until the process has exited and the pipe has been closed. This causes some previous discarded errors to be propagated. Fix these as well.
2025-05-04feat(messages): cleanup Lua error messagesJustin M. Keyes1
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
2025-05-04test: multiline assert_log()Justin M. Keyes1
Problem: assert_log() only matches single lines. This was never an intentional decision, it was merely a result of using read_file_list(). Note: any tests that indiscriminately match `.*` should be rewritten to avoid (unlikely) "false positives". I checked all existing tests. Solution: Change assert_log() to match the concatenated lines instead of matching per-line.
2025-05-02feat(build): build.zig MVP: build and run functionaltests on linuxbfredl1
NEW BUILD SYSTEM! This is a MVP implementation which supports building the "nvim" binary, including cross-compilation for some targets. As an example, you can build a aarch64-macos binary from an x86-64-linux-gnu host, or vice versa Add CI target for build.zig currently for functionaltests on linux x86_64 only Follow up items: - praxis for version and dependency bumping - windows 💀 - full integration of libintl and gettext (or a desicion not to) - update help and API metadata files - installation into a $PREFIX - more tests and linters
2025-03-02test: simplify ASAN detectiondundargoc1
2025-03-02build!: turn off translations by defaultdundargoc1
The translation step prolongs the build time too much to be enabled by default. Enable it by passing cmake flag `ENABLE_TRANSLATIONS=ON`.
2025-02-26feat(lua): vim.text.indent()Justin M. Keyes1
Problem: Indenting text is a common task in plugins/scripts for presentation/formatting, yet vim has no way of doing it (especially "dedent", and especially non-buffer text). Solution: Introduce `vim.text.indent()`. It sets the *exact* indentation because that's a more difficult (and thus more useful) task than merely "increasing the current indent" (which is somewhat easy with a `gsub()` one-liner).
2025-01-14feat(vim.fs): find(), dir() can "follow" symlinks #31551Mike1
Problem: vim.fs.dir(), vim.fs.find() do not follow symlinks. Solution: - Add "follow" flag. - Enable it by default.
2025-01-13feat: add vim.fs.relpathdundargoc1
This is needed to replace the nvim-lspconfig function is_descendant that some lspconfg configurations still use.
2024-12-16fix(Man): completion on MacLewis Russell1
Problem: `man -w` does not work on recent versions of MacOs. Solution: Make it so an empty result is interpreted as an error unless silent=true
2024-11-06fix(test): better management of tmpfilesLewis Russell1
Problem: When tmpdir is local. The returned values from tmpname may already exist. This can cause problems for tests which pass `create=false` as they may require the file to not exist yet. Solution: When creating tmp names, always remove it to ensure it doesn't exist, and optionally open it if `create~=false` Additionally refactor the tmpname code and flattrn some functions into constants. Also while debugging this issue. It was discovered that `exec_lua()` doesn't report error messages properly. This has been fixed.
2024-09-23fix(vim.fs): dirname() returns "." on mingw/msys2 #30480Justin M. Keyes1
Problem: `vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on mingw/msys2. Solution: - Check for "mingw" when deciding `iswin`. - Use `has("win32")` where possible, it works in "fast" contexts since b02eeb6a7281df0561a021d7ae595c84be9a01be.
2024-09-09refactor(test): rename alter_slashes, invert its behaviorJustin M. Keyes1
- `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes.
2024-09-08fix(startup): server fails if $NVIM_APPNAME is relative dir #30310Justin M. Keyes1
Problem: If $NVIM_APPNAME is a relative dir path, Nvim fails to start its primary/default server, and `v:servername` is empty. Root cause is d34c64e342dfba9248d1055e702d02620a1b31a8, but this wasn't noticed until 96128a5076b7 started reporting the error more loudly. Solution: - `server_address_new`: replace slashes "/" in the appname before using it as a servername. - `vim_mktempdir`: always prefer the system-wide top-level "nvim.user/" directory. That isn't intended to be specific to NVIM_APPNAME; rather, each *subdirectory* ("nvim.user/xxx") is owned by each Nvim instance. Nvim "apps" can be identified by the server socket(s) stored in those per-Nvim subdirs. fix #30256
2024-09-05test: avoid noise in CI logs #30264Justin M. Keyes1
Problem: Since 96128a5076b7 the test logs have noise from tests that *expect* failures: $NVIM_LOG_FILE: /tmp/cirrus-ci-build/build/.nvimlog (last 100 lines) ERR 2024-09-04T13:38:45.181 T949.28335.0/c terminfo_start:486: uv_pipe_open failed: no such device or address ERR 2024-09-04T13:38:45.181 T949.28335.0/c flush_buf:2527: uv_write failed: bad file descriptor ERR 2024-09-04T13:38:45.181 T949.28335.0/c flush_buf:2527: uv_write failed: bad file descriptor WRN 2024-09-04T13:43:43.294 ?.35904 server_start:173: Failed to start server: address already in use: /…/Xtest_tmpdir/…/T7159.35895.0 WRN 2024-09-04T13:43:43.314 ?.35907 server_start:173: Failed to start server: illegal operation on a directory: / ERR 2024-09-04T13:43:43.332 ?.35909 socket_watcher_init:60: Host lookup failed: https://example.com Solution: Rewrite the test to use `vim.system()`. Set NVIM_LOG_FILE in the child process to a "throwaway" logfile.
2024-09-03test: tmpname(create:boolean) #30242Justin M. Keyes1
Problem: 137f98cf6428 added the `create` parameter to `tmpname()` but didn't fully implement it. Solution: - Update impl for the `os.tmpname()` codepath. - Inspect all usages of `tmpname()`, update various tests.
2024-09-02test: tmpname() can skip file creationJustin M. Keyes1
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-20refactor(lua): "module" => "M" #28426Justin M. Keyes1
Most of the codebase uses the `M` convention for Lua module. Update the last remaining cases.
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.