From f1490b5fe9fcfec083ddca6fcf16f6df2df107e7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 Feb 2026 21:43:44 +0800 Subject: [PATCH] test: don't test overriding argv[0] using FFI (#38012) Instead, test this by adding a new functionality to shell-test, allowing reuse in other future tests. --- test/functional/fixtures/shell-test.c | 10 ++++++++++ test/functional/terminal/tui_spec.lua | 20 +++++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c index 9eac77fc37..2a478c9bac 100644 --- a/test/functional/fixtures/shell-test.c +++ b/test/functional/fixtures/shell-test.c @@ -31,6 +31,8 @@ static void help(void) puts(" Prints \"ready $ prog args...\\n\" to stderr."); puts(" shell-test -t {prompt text} EXE \"prog args...\""); puts(" Prints \"{prompt text} $ progs args...\" to stderr."); + puts(" shell-test EXECVP \"prog\" \"arg0\" args..."); + puts(" Executes prog arg0 args... using execvp()."); puts(" shell-test REP N {text}"); puts(" Prints \"{lnr}: {text}\\n\" to stdout N times, pausing every 100 lines."); puts(" Example:"); @@ -73,6 +75,14 @@ int main(int argc, char **argv) } else { fprintf(stderr, "ready $ "); } +#ifndef _MSG_VER + } else if (strcmp(argv[1], "EXECVP") == 0) { + if (argc < 4) { + fprintf(stderr, "Not enough arguments for EXECVP\n"); + return 6; + } + execvp(argv[2], argv + 3); +#endif } else if (strcmp(argv[1], "REP") == 0 || strcmp(argv[1], "REPFAST") == 0) { bool fast = strcmp(argv[1], "REPFAST") == 0; if (argc != 4) { diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index af294a7859..59fe25c30a 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -2924,22 +2924,12 @@ describe('TUI', function() it('argv[0] can be overridden #23953', function() t.skip(is_os('win'), 'N/A for Windows') - if not exec_lua('return pcall(require, "ffi")') then - pending('N/A: missing LuaJIT FFI') - end - local script_file = 'Xargv0.lua' - write_file( - script_file, - [=[ - local ffi = require('ffi') - ffi.cdef([[int execl(const char *, const char *, ...);]]) - ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean', nil) - ]=] + local screen = Screen.new(50, 7, { rgb = false }) + fn.jobstart( + { testprg('shell-test'), 'EXECVP', nvim_prog, 'Xargv0nvim', '--clean' }, + { term = true, env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } } ) - finally(function() - os.remove(script_file) - end) - local screen = tt.setup_child_nvim({ '--clean', '-l', script_file }) + command('startinsert') screen:expect([[ ^ | ~ |*3