Skip to content

Commit f91064f

Browse files
TrottMylesBorins
authored andcommittedMar 21, 2018
test: move tmpdir to submodule of common
Move tmpdir functionality to its own module (common/tmpdir). Backport-PR-URL: #19488 PR-URL: #17856 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 2a0ed0e commit f91064f

File tree

154 files changed

+639
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+639
-450
lines changed
 

‎benchmark/http/http_server_for_chunky_client.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,15 @@
22

33
const assert = require('assert');
44
const http = require('http');
5-
const fs = require('fs');
65
const { fork } = require('child_process');
76
const common = require('../common.js');
8-
const { PIPE, tmpDir } = require('../../test/common');
7+
const { PIPE } = require('../../test/common');
8+
const tmpdir = require('../../test/common/tmpdir');
99
process.env.PIPE_NAME = PIPE;
1010

11-
try {
12-
fs.accessSync(tmpDir, fs.F_OK);
13-
} catch (e) {
14-
fs.mkdirSync(tmpDir);
15-
}
11+
tmpdir.refresh();
1612

1713
var server;
18-
try {
19-
fs.unlinkSync(process.env.PIPE_NAME);
20-
} catch (e) { /* ignore */ }
2114

2215
server = http.createServer(function(req, res) {
2316
const headers = {

‎benchmark/module/module-loader.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ const fs = require('fs');
33
const path = require('path');
44
const common = require('../common.js');
55

6-
const { refreshTmpDir, tmpDir } = require('../../test/common');
7-
const benchmarkDirectory = path.join(tmpDir, 'nodejs-benchmark-module');
6+
const tmpdir = require('../../test/common/tmpdir');
7+
const benchmarkDirectory = path.join(tmpdir.path, 'nodejs-benchmark-module');
88

99
const bench = common.createBenchmark(main, {
1010
thousands: [50],
@@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, {
1515
function main(conf) {
1616
const n = +conf.thousands * 1e3;
1717

18-
refreshTmpDir();
18+
tmpdir.refresh();
1919
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
2020

2121
for (var i = 0; i <= n; i++) {
@@ -35,7 +35,7 @@ function main(conf) {
3535
else
3636
measureDir(n, conf.useCache === 'true');
3737

38-
refreshTmpDir();
38+
tmpdir.refresh();
3939
}
4040

4141
function measureFull(n, useCache) {

0 commit comments

Comments
 (0)