test: do not modify fixtures in test-fs-chmod · nodejs/node@644d990
@@ -50,14 +50,17 @@ if (common.isWindows) {
5050mode_sync = 0o644;
5151}
525253-const file1 = path.join(common.fixturesDir, 'a.js');
54-const file2 = path.join(common.fixturesDir, 'a1.js');
53+common.refreshTmpDir();
54+55+const file1 = path.join(common.tmpDir, 'a.js');
56+const file2 = path.join(common.tmpDir, 'a1.js');
57+58+// Create file1.
59+fs.closeSync(fs.openSync(file1, 'w'));
55605661fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
5762assert.ifError(err);
586359-console.log(fs.statSync(file1).mode);
60-6164if (common.isWindows) {
6265assert.ok((fs.statSync(file1).mode & 0o777) & mode_async);
6366} else {
@@ -72,14 +75,12 @@ fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
7275}
7376}));
747775-fs.open(file2, 'a', common.mustCall((err, fd) => {
78+fs.open(file2, 'w', common.mustCall((err, fd) => {
7679assert.ifError(err);
77807881fs.fchmod(fd, mode_async.toString(8), common.mustCall((err) => {
7982assert.ifError(err);
808381-console.log(fs.fstatSync(fd).mode);
82-8384if (common.isWindows) {
8485assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async);
8586} else {
@@ -101,13 +102,11 @@ fs.open(file2, 'a', common.mustCall((err, fd) => {
101102if (fs.lchmod) {
102103const link = path.join(common.tmpDir, 'symbolic-link');
103104104-common.refreshTmpDir();
105105fs.symlinkSync(file2, link);
106106107107fs.lchmod(link, mode_async, common.mustCall((err) => {
108108assert.ifError(err);
109109110-console.log(fs.lstatSync(link).mode);
111110assert.strictEqual(mode_async, fs.lstatSync(link).mode & 0o777);
112111113112fs.lchmodSync(link, mode_sync);