Skip to content

Commit eaed642

Browse files
committed
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.
1 parent ce72fcc commit eaed642

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/parallel/test-process-execve-no-args.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ if (!existsSync(executable)) {
2020
skip(executable + ' binary is not available');
2121
}
2222

23-
process.execve(executable);
23+
// The binary may need `LD_LIBRARY_PATH` or equivalent set to run.
24+
// The assumption here is that if `node` was configured to link to
25+
// any external libraries then the test binary was as well.
26+
if (process.config.target_defaults.libraries.length > 0) {
27+
process.execve(executable, undefined, process.env);
28+
} else {
29+
process.execve(executable);
30+
}
2431
// If process.execve succeeds, this should never be executed.
2532
fail('process.execve failed');

0 commit comments

Comments
 (0)