Skip to content

Commit

Permalink
test: do not open fixture files for writing
Browse files Browse the repository at this point in the history
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: #17810
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
Trott committed Dec 22, 2017
1 parent 66e6aff commit c339931
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/parallel/test-fs-open-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

0 comments on commit c339931

Please sign in to comment.