From 3fc70502b70207caec6f916bfcc2c07f31179587 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 5 Nov 2017 02:12:23 -0800 Subject: [PATCH] benchmark: use unique filenames in fs benchmarks Use a unique file name for each benchmark. Running benchmarks simultaneously may be a bit of an unusual use case, but there are use cases, such as stress testing `test/parallel/test-benchmark-fs.js`. PR-URL: https://github.com/nodejs/node/pull/16776 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- benchmark/fs/read-stream-throughput.js | 3 ++- benchmark/fs/readfile.js | 3 ++- benchmark/fs/write-stream-throughput.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index 4412d41f98dc65..85aa3c929feb83 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -3,7 +3,8 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(__dirname, '.removeme-benchmark-garbage'); +const filename = path.resolve(__dirname, + `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const assert = require('assert'); diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index d89061d6061b0c..82479ff14e5f68 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -5,7 +5,8 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(__dirname, '.removeme-benchmark-garbage'); +const filename = path.resolve(__dirname, + `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const bench = common.createBenchmark(main, { diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index 2083cccbd6ac81..5c6464fdbb2cbb 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -3,7 +3,8 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(__dirname, '.removeme-benchmark-garbage'); +const filename = path.resolve(__dirname, + `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const bench = common.createBenchmark(main, {