GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: relax Y2K38 check in test-fs-utimes-y2K38 · nodejs/node@e57e532

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-fs-utimes-y2K38.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-fs-utimes-y2K38.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-utimes-y2K38.js
+14-11Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
'use strict';
22
const common = require('../common');
33

4-
if (common.isIBMi) {
5-
common.skip('fs.utimesSync() currently fails on IBM i with Y2K38 values');
6-
}
7-
84
const tmpdir = require('../common/tmpdir');
95
tmpdir.refresh();
106

117
const assert = require('assert');
128
const fs = require('fs');
139

14-
// Check for Y2K38 support. For Windows and AIX, assume it's there. Windows
10+
// Check for Y2K38 support. For Windows, assume it's there. Windows
1511
// doesn't have `touch` and `date -r` which are used in the check for support.
16-
// AIX lacks `date -r`.
17-
if (!common.isWindows && !common.isAIX) {
12+
if (!common.isWindows) {
1813
const testFilePath = `${tmpdir.path}/y2k38-test`;
1914
const testFileDate = '204001020304';
2015
const { spawnSync } = require('child_process');
@@ -25,13 +20,21 @@ if (!common.isWindows && !common.isAIX) {
2520
common.skip('File system appears to lack Y2K38 support (touch failed)');
2621
}
2722

23+
// On some file systems that lack Y2K38 support, `touch` will succeed but
24+
// the time will be incorrect.
2825
const dateResult = spawnSync('date',
2926
['-r', testFilePath, '+%Y%m%d%H%M'],
3027
{ encoding: 'utf8' });
31-
32-
assert.strictEqual(dateResult.status, 0);
33-
if (dateResult.stdout.trim() !== testFileDate) {
34-
common.skip('File system appears to lack Y2k38 support (date failed)');
28+
if (dateResult.status === 0) {
29+
if (dateResult.stdout.trim() !== testFileDate) {
30+
common.skip('File system appears to lack Y2k38 support (date failed)');
31+
}
32+
} else {
33+
// On some platforms `date` may not support the `-r` option. Usually
34+
// this will result in a non-zero status and usage information printed.
35+
// In this case optimistically proceed -- the earlier `touch` succeeded
36+
// but validation that the file has the correct time is not easily possible.
37+
assert.match(dateResult.stderr, /[Uu]sage:/);
3538
}
3639
}
3740

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.