From eaed6427d6814f2712d67ed020ecef01f5fcdc95 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 26 Sep 2025 16:43:15 +0000 Subject: [PATCH] test: fix test when linked with shared libraries If the `nop` binary used in `parallel/test-process-execve-no-args` has been linked to external libraries, it may need an environment variable such as `LD_LIBRARY_PATH` to be set to be able to run. Assume if `node` has been configured to link against any external libraries then `nop` has also been, and in that case pass through the environment variables to the test. --- test/parallel/test-process-execve-no-args.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-process-execve-no-args.js b/test/parallel/test-process-execve-no-args.js index 908512622cf00f..902f250037b428 100644 --- a/test/parallel/test-process-execve-no-args.js +++ b/test/parallel/test-process-execve-no-args.js @@ -20,6 +20,13 @@ if (!existsSync(executable)) { skip(executable + ' binary is not available'); } -process.execve(executable); +// The binary may need `LD_LIBRARY_PATH` or equivalent set to run. +// The assumption here is that if `node` was configured to link to +// any external libraries then the test binary was as well. +if (process.config.target_defaults.libraries.length > 0) { + process.execve(executable, undefined, process.env); +} else { + process.execve(executable); +} // If process.execve succeeds, this should never be executed. fail('process.execve failed');