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:
authorRich Trott <rtrott@gmail.com>2022-11-06 18:53:18 +0300
committerRich Trott <rtrott@gmail.com>2022-11-07 22:12:19 +0300
commite080331a01a88038cd4c9823f74305fa7889dbb7 (patch)
treeae2b9c5aab8b34ba0d06dbb05c2256d3e4ee61af
parent2119fa48fbc68a88ee6cbf669e136d221fb20438 (diff)
test: skip test-fs-largefile if not enough disk space
Fixes: https://github.com/nodejs/build/issues/3071 PR-URL: https://github.com/nodejs/node/pull/45339 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
-rw-r--r--test/pummel/test-fs-largefile.js40
1 files changed, 24 insertions, 16 deletions
diff --git a/test/pummel/test-fs-largefile.js b/test/pummel/test-fs-largefile.js
index 9c2b26782d9..7f2630f497b 100644
--- a/test/pummel/test-fs-largefile.js
+++ b/test/pummel/test-fs-largefile.js
@@ -29,21 +29,29 @@ const path = require('path');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
-const filepath = path.join(tmpdir.path, 'large.txt');
-const fd = fs.openSync(filepath, 'w+');
-const offset = 5 * 1024 * 1024 * 1024; // 5GB
-const message = 'Large File';
+try {
-fs.ftruncateSync(fd, offset);
-assert.strictEqual(fs.statSync(filepath).size, offset);
-const writeBuf = Buffer.from(message);
-fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset);
-const readBuf = Buffer.allocUnsafe(writeBuf.length);
-fs.readSync(fd, readBuf, 0, readBuf.length, offset);
-assert.strictEqual(readBuf.toString(), message);
-fs.readSync(fd, readBuf, 0, 1, 0);
-assert.strictEqual(readBuf[0], 0);
+ const filepath = path.join(tmpdir.path, 'large.txt');
+ const fd = fs.openSync(filepath, 'w+');
+ const offset = 5 * 1024 * 1024 * 1024; // 5GB
+ const message = 'Large File';
-// Verify that floating point positions do not throw.
-fs.writeSync(fd, writeBuf, 0, writeBuf.length, 42.000001);
-fs.close(fd, common.mustCall());
+ fs.ftruncateSync(fd, offset);
+ assert.strictEqual(fs.statSync(filepath).size, offset);
+ const writeBuf = Buffer.from(message);
+ fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset);
+ const readBuf = Buffer.allocUnsafe(writeBuf.length);
+ fs.readSync(fd, readBuf, 0, readBuf.length, offset);
+ assert.strictEqual(readBuf.toString(), message);
+ fs.readSync(fd, readBuf, 0, 1, 0);
+ assert.strictEqual(readBuf[0], 0);
+
+ // Verify that floating point positions do not throw.
+ fs.writeSync(fd, writeBuf, 0, writeBuf.length, 42.000001);
+ fs.close(fd, common.mustCall());
+} catch (e) {
+ if (e.code !== 'ENOSPC') {
+ throw e;
+ }
+ common.skip('insufficient disk space');
+}