Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Reis <reis@janeasystems.com>2019-07-30 18:55:15 +0300
committerRich Trott <rtrott@gmail.com>2019-08-11 05:21:35 +0300
commit0376b5b7baf627b112915183edf9e1ea2d3856b7 (patch)
treecc03285eef5bba8a7f2e80498e43476561cd15a2 /benchmark
parent3eea43af074e129963a3398dc91ce22a589f8a13 (diff)
benchmark: use test/common/tmpdir consistently
Many benchmarks use test/common/tmpdir. This changes 3 benchmarks that use NODE_TMPDIR to also use test/common/tmpdir. This is necessary in preparation for the next commit that changes tmpdir to delete tmpdir.path when the Node.js process exits. Thus, if multiple benchmarks are run sequentially, the ones that use tmpdir will remove the directory and the ones changed here would fail because it does not exist. This happens when running test/benchmark. Note: to explicitly select a directory for tmpdir, use NODE_TEST_DIR. PR-URL: https://github.com/nodejs/node/pull/28858 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/fs/read-stream-throughput.js7
-rw-r--r--benchmark/fs/readfile.js7
-rw-r--r--benchmark/fs/write-stream-throughput.js7
3 files changed, 15 insertions, 6 deletions
diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js
index cb5d98dc327..4c8de582418 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 551804b1dba..7460c8e233e 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 3936adc7ff1..44de0900d8e 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'],