summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-open-flags.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-12-21 14:46:46 -0800
committerRich Trott <rtrott@gmail.com>2017-12-22 15:26:49 -0800
commitc339931d8b3dbf3fb2a4fa4164bbf585759831c0 (patch)
tree899073fc59c821349cc5c2a2e19bb35446dbcd23 /test/parallel/test-fs-open-flags.js
parent66e6affb428efdfc8de1db4bd9d6dfd7984ebb44 (diff)
downloadandroid-node-v8-c339931d8b3dbf3fb2a4fa4164bbf585759831c0.tar.gz
android-node-v8-c339931d8b3dbf3fb2a4fa4164bbf585759831c0.tar.bz2
android-node-v8-c339931d8b3dbf3fb2a4fa4164bbf585759831c0.zip
test: do not open fixture files for writing
Use temp directory for open with `O_DSYNC` (which indicates a write may occur) rather than `fixtures` directory. Additionally, test can be run on macOS so allow that in addition to Linux. PR-URL: https://github.com/nodejs/node/pull/17810 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-open-flags.js')
-rw-r--r--test/parallel/test-fs-open-flags.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js
index c73dbb5c6e..aa87f8ced8 100644
--- a/test/parallel/test-fs-open-flags.js
+++ b/test/parallel/test-fs-open-flags.js
@@ -22,10 +22,12 @@
// Flags: --expose_internals
'use strict';
const common = require('../common');
+
const fixtures = require('../common/fixtures');
-const assert = require('assert');
+const assert = require('assert');
const fs = require('fs');
+const path = require('path');
const O_APPEND = fs.constants.O_APPEND || 0;
const O_CREAT = fs.constants.O_CREAT || 0;
@@ -81,8 +83,9 @@ common.expectsError(
{ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }
);
-if (common.isLinux) {
- const file = fixtures.path('a.js');
-
+if (common.isLinux || common.isOSX) {
+ common.refreshTmpDir();
+ const file = path.join(common.tmpDir, 'a.js');
+ fs.copyFileSync(fixtures.path('a.js'), file);
fs.open(file, O_DSYNC, common.mustCall(assert.ifError));
}