summaryrefslogtreecommitdiff
path: root/test/common/index.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2018-10-10 11:24:51 -0700
committerRich Trott <rtrott@gmail.com>2018-10-12 13:48:42 -0700
commitf897843359a1f1b8dc9839105b84dcc50a15e1f6 (patch)
treea188059551af314ed5c279b17edeb10f9c3762bf /test/common/index.js
parentbcbb9370ddaa223110fcd8584e41336b791e7e7f (diff)
downloadandroid-node-v8-f897843359a1f1b8dc9839105b84dcc50a15e1f6.tar.gz
android-node-v8-f897843359a1f1b8dc9839105b84dcc50a15e1f6.tar.bz2
android-node-v8-f897843359a1f1b8dc9839105b84dcc50a15e1f6.zip
test: refactor common.ddCommand()
* Remove different paths for Windows and POSIX. * Remove fixtures file. Simply run the command immediately/directly. * Since it is never called with more than one value for kilobytes, eliminate that argument. * Update/simplify tests that use this function. (They no longer need to use child_process to run the command.) * Update documentation. PR-URL: https://github.com/nodejs/node/pull/23411 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com>
Diffstat (limited to 'test/common/index.js')
-rw-r--r--test/common/index.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/test/common/index.js b/test/common/index.js
index 75fe2e1548..492bb2f357 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -28,7 +28,6 @@ const assert = require('assert');
const os = require('os');
const { exec, execSync, spawnSync } = require('child_process');
const util = require('util');
-const { fixturesDir } = require('./fixtures');
const tmpdir = require('./tmpdir');
const {
bits,
@@ -174,13 +173,10 @@ function childShouldThrowAndAbort() {
});
}
-function ddCommand(filename, kilobytes) {
- if (isWindows) {
- const p = path.resolve(fixturesDir, 'create-file.js');
- return `"${process.argv[0]}" "${p}" "${filename}" ${kilobytes * 1024}`;
- } else {
- return `dd if=/dev/zero of="${filename}" bs=1024 count=${kilobytes}`;
- }
+function ddCommand(filename) {
+ const fd = fs.openSync(filename, 'w');
+ fs.ftruncateSync(fd, 10 * 1024 * 1024);
+ fs.closeSync(fd);
}