test: prevent V8 from writing into the system's tmpdir

Refs: https://github.com/nodejs/build/issues/3864
PR-URL: https://github.com/nodejs/node/pull/54395
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Michaël Zasso 2024-08-21 17:44:39 +02:00 committed by GitHub
parent b4344cf006
commit 612e4577ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,7 +93,12 @@ function expectNoWorker(opt, want, command, wantsError) {
function expect(
opt, want, command = 'console.log("B")', wantsError = false, testWorker = true
) {
const argv = ['-e', command];
const argv = [
// --perf-basic-prof and --perf-basic-prof-only-functions write to /tmp by default.
`--perf-basic-prof-path=${tmpdir.path}`,
'-e',
command,
];
const opts = {
cwd: tmpdir.path,
env: Object.assign({}, process.env, { NODE_OPTIONS: opt }),