diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index cb5d98dc3279f6..4c8de582418960 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -3,11 +3,14 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(process.env.NODE_TMPDIR || __dirname, - `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const assert = require('assert'); +const tmpdir = require('../../test/common/tmpdir'); +tmpdir.refresh(); +const filename = path.resolve(tmpdir.path, + `.removeme-benchmark-garbage-${process.pid}`); + let encodingType, encoding, size, filesize; const bench = common.createBenchmark(main, { diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index 551804b1dbab1f..7460c8e233e59f 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -5,11 +5,14 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(process.env.NODE_TMPDIR || __dirname, - `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const assert = require('assert'); +const tmpdir = require('../../test/common/tmpdir'); +tmpdir.refresh(); +const filename = path.resolve(tmpdir.path, + `.removeme-benchmark-garbage-${process.pid}`); + const bench = common.createBenchmark(main, { dur: [5], len: [1024, 16 * 1024 * 1024], diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index 3936adc7ff1b42..44de0900d8ed15 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -3,10 +3,13 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(process.env.NODE_TMPDIR || __dirname, - `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); +const tmpdir = require('../../test/common/tmpdir'); +tmpdir.refresh(); +const filename = path.resolve(tmpdir.path, + `.removeme-benchmark-garbage-${process.pid}`); + const bench = common.createBenchmark(main, { dur: [5], encodingType: ['buf', 'asc', 'utf'], diff --git a/test/benchmark/test-benchmark-fs.js b/test/benchmark/test-benchmark-fs.js index 7ae32fe617d58f..efb2c453bde77d 100644 --- a/test/benchmark/test-benchmark-fs.js +++ b/test/benchmark/test-benchmark-fs.js @@ -19,4 +19,4 @@ runBenchmark('fs', [ 'filesize=1024', 'dir=.github', 'withFileTypes=false' -], { NODE_TMPDIR: tmpdir.path, NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); +], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });