aboutsummaryrefslogtreecommitdiff
path: root/test/client
Commit message (Collapse)AuthorAge
* test: improve Nvim EOF handling (for Windows CI) #40841Justin M. Keyes2026-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Mysterious Windows CI failure points to resource exhaustion, but we have no visibility/instrumentation: RUN T610 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <S-Left>: 93.70 ms OK RUN T611 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <F12><F2><Tab>: 49.48 ms FAIL …\testnvim.lua:144: EOF was received from Nvim. Likely the Nvim process crashed. stack traceback: D:/a/neovim/neovim/test/functional/testnvim.lua:144: in function 'nvim_set_keymap' …/api/keymap_spec.lua:769: in function <…/api/keymap_spec.lua:768> RUN T612 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <Space><Tab>: 18.49 ms FAIL …\testnvim.lua:144: EOF was received from Nvim. Likely the Nvim process crashed. stack traceback: D:/a/neovim/neovim/test/functional/testnvim.lua:144: in function 'nvim_set_keymap' …/api/keymap_spec.lua:769: in function <.../build/Xtest_xdg_api/test/functional/api/keymap_spec.lua:768> Solution: Append the child exit-code and signal to the "EOF … crashed" message. Example: Nvim EOF (crash?) exit code: 42 (0x0000002A) On the next failing Windows run, the first crash line will classify the failure: - 0xC0000005 → access violation (nvim bug) - 0xC0000374 → heap corruption (nvim bug) - spawn/resource error or "clean" exit-code → system resource exhaustion
* test: run Lua harness with nvim -lLewis Russell2026-05-13
| | | | | | | | | | | | | | | | | | Problem: The Lua test harness still ran through standalone -ll mode, so tests depended on the low-level Lua path instead of the regular Nvim Lua environment. That also meant os.exit() coverage had to carry an ASAN workaround because Lua's raw process exit skipped Nvim teardown and let LeakSanitizer interfere with the observed exit code. Solution: Run the harness and related fixtures with nvim -l. Patch os.exit() in the main Lua state to exit through getout(), so scripts observe normal Nvim shutdown while standalone -ll remains available for generator-style scripts. As a consequence, the startup test can assert os.exit() without disabling leak detection. AI-assisted: Codex
* feat(:restart): v:starttime, v:exitreason #39282Justin M. Keyes2026-04-22
| | | | | | | | | | | | Problem: - The `ZR` feature makes it more obvious that we need some sort of flag so that an `ExitPre` / `QuitPre` / `VimLeave` handler can handle restarts differently than a normal exit. For example, it's common that users want `:mksession` on restart, but perhaps not on a normal exit. - Nvim has no way to report its "uptime". Solution: - Introduce `v:starttime` - Introduce `v:exitreason`
* feat(normal): normal-mode ZR does :restartJustin M. Keyes2026-04-21
| | | | Make it a normal-mode command instead of a default mapping.
* test: wait for uv.pipe_connect() callback (#37640)zeertzjq2026-02-01
| | | | | | | | | | Problem: On Windows, writing to a pipe doesn't work if the pipe isn't connected yet. This causes an RPC request to a session newly created by connect() to hang, as it's waiting for a response to a request that never reaches the server. Solution: Wait for uv.pipe_connect() callback to be called when using connect().
* test: fix some type warnings (#37483)zeertzjq2026-01-21
|
* test(client): check for uv.run() failure (#37379)zeertzjq2026-01-14
| | | Related #37376
* fix(shell): ceci n'est pas une pipebfredl2026-01-13
| | | | | | | | | | | | | | | | | | On linux /dev/stdin is defined as a symlink to /proc/self/fd/0 This in turn is defined as a "magic" symlink which is allowed to point to internal kernel objects which really does not have a file name. As a glaring inconsistency, fopen("/proc/self/fd/0", "r") works if fd was originally opened using pipe() but not using socketpair(). As it happens UV_CREATE_PIPE does not create pipes but creates socket pairs. These two unfortunate conditions means that using /dev/stdin and similar does not work in shell commands in nvim on linux. as a work around, override libuv's descicion and create an actual pipe pair. This change is not needed on BSD:s but done unconditionally for simplicity, except for on windows where it is not done for stdout because of windows fixes #35984
* test: don't block to wait for previous session's exit (#35885)zeertzjq2025-09-23
| | | This reduces the time taken by clear() by over 20% with ASAN.
* test: use spawn_wait() instead of system() #31852Justin M. Keyes2025-01-04
| | | | | | | | | | | Problem: Tests that need to check `nvim` CLI behavior (no RPC session) create their own ad-hoc `system()` wrappers. Solution: - Use `n.spawn_wait` instead of `system()`. - Bonus: this also improves the tests by explicitly checking for `stdout` or `stderr`. And if a signal is raised, `ProcStream.status` will reflect it.
* test: include stderr in EOF failure messageJustin M. Keyes2025-01-03
|
* test: spawn_wait() starts a non-RPC Nvim processJustin M. Keyes2025-01-03
| | | | | | | | | | | Problem: Can't use `n.clear()` to test non-RPC `nvim` invocations. So tests end up creating ad-hoc wrappers around `system()` or `jobstart()`. Solution: - Introduce `n.spawn_wait()` - TODO (followup PR): Rename `n.spawn()` and `n.spawn_wait()`. It's misleading that `n.spawn()` returns a RPC session...
* test: support upvalues in exec_luaLewis Russell2024-09-21
|
* feat(tui): builtin UI (TUI) sets client info #30397Justin M. Keyes2024-09-18
| | | | | | | | | | | | Problem: The default builtin UI client does not declare its client info. This reduces discoverability and makes it difficult for plugins to identify the UI. Solution: - Call nvim_set_client_info after attaching, as recommended by `:help dev-ui`. - Also set the "pid" field. - Also change `ui_active()` to return a count. Not directly relevant to this commit, but will be useful later.
* refactor(tests): rename terminal/testutil.lua => testterm.lua #30372Justin M. Keyes2024-09-15
| | | | | This module is generally used by any tests that need the full Nvim TUI instead of `screen.lua`. Thus it should live in `functional/` instead of in `functional/terminal/`.
* fix(api/buffer): fix handling of viewport of non-current bufferbfredl2024-03-13
| | | | | | | | | | | A lot of functions in move.c only worked for curwin, alternatively took a `wp` arg but still only work if that happens to be curwin. Refactor those that are needed for update_topline(wp) to work for any window. fixes #27723 fixes #27720
* test: add type annotationsLewis Russell2024-01-17
|
* test: use integers for API Buffer/Window/Tabpage EXT typesLewis Russell2024-01-16
|
* test: use vim.mpack and vim.uv directlyLewis Russell2024-01-12
|
* build: enable lintlua for test/unit/ dir #26396Justin M. Keyes2023-12-04
| | | | | | | | | | | | | Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `test/unit/` directory. - TODO: only `test/functional/` remains unchecked. previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b previous: 517f0cc634b985057da5b95cf4ad659ee456a77e
* refactor(map): enhanced implementation, Clean Code™, etc etcbfredl2023-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This involves two redesigns of the map.c implementations: 1. Change of macro style and code organization The old khash.h and map.c implementation used huge #define blocks with a lot of backslash line continuations. This instead uses the "implementation file" .c.h pattern. Such a file is meant to be included multiple times, with different macros set prior to inclusion as parameters. we already use this pattern e.g. for eval/typval_encode.c.h to implement different typval encoders reusing a similar structure. We can structure this code into two parts. one that only depends on key type and is enough to implement sets, and one which depends on both key and value to implement maps (as a wrapper around sets, with an added value[] array) 2. Separate the main hash buckets from the key / value arrays Change the hack buckets to only contain an index into separate key / value arrays This is a common pattern in modern, state of the art hashmap implementations. Even though this leads to one more allocated array, it is this often is a net reduction of memory consumption. Consider key+value consuming at least 12 bytes per pair. On average, we will have twice as many buckets per item. Thus old implementation: 2*12 = 24 bytes per item New implementation 1*12 + 2*4 = 20 bytes per item And the difference gets bigger with larger items. One might think we have pulled a fast one here, as wouldn't the average size of the new key/value arrays be 1.5 slots per items due to amortized grows? But remember, these arrays are fully dense, and thus the accessed memory, measured in _cache lines_, the unit which actually matters, will be the fully used memory but just rounded up to the nearest cache line boundary. This has some other interesting properties, such as an insert-only set/map will be fully ordered by insert only. Preserving this ordering in face of deletions is more tricky tho. As we currently don't use ordered maps, the "delete" operation maintains compactness of the item arrays in the simplest way by breaking the ordering. It would be possible to implement an order-preserving delete although at some cost, like allowing the items array to become non-dense until the next rehash. Finally, in face of these two major changes, all code used in khash.h has been integrated into map.c and friends. Given the heavy edits it makes no sense to "layer" the code into a vendored and a wrapper part. Rather, the layered cake follows the specialization depth: code shared for all maps, code specialized to a key type (and its equivalence relation), and finally code specialized to value+key type.
* fix(client): wait for session to exitbfredl2023-02-10
| | | | | | This replicates the old native.pid_wait(self._pid) call, except using the proper libuv pattern (run loop unitil exit callback)
* refactor(tests): move lua-client into core and use it for functionaltestsbfredl2023-02-10
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)