@@ -7,17 +7,27 @@ const fs = require('fs');
7
7
8
8
tmpdir . refresh ( ) ;
9
9
10
- // Check for Y2K38 support. For Windows, assume it's there. Windows doesn't have
11
- // `touch`.
12
- if ( ! common . isWindows ) {
10
+ // Check for Y2K38 support. For Windows and AIX, assume it's there. Windows
11
+ // doesn't have `touch` and `date -r` which are used in the check for support.
12
+ // AIX lacks `date -r`.
13
+ if ( ! common . isWindows && ! common . isAIX ) {
13
14
const testFilePath = `${ tmpdir . path } /y2k38-test` ;
14
15
const testFileDate = '204001020304' ;
15
16
const { spawnSync } = require ( 'child_process' ) ;
16
- const { status } = spawnSync ( 'touch' ,
17
- [ '-t' , testFileDate , testFilePath ] ,
17
+ const touchResult = spawnSync ( 'touch' ,
18
+ [ '-t' , testFileDate , testFilePath ] ,
19
+ { encoding : 'utf8' } ) ;
20
+ if ( touchResult . status !== 0 ) {
21
+ common . skip ( 'File system appears to lack Y2K38 support (touch failed)' ) ;
22
+ }
23
+
24
+ const dateResult = spawnSync ( 'date' ,
25
+ [ '-r' , testFilePath , '+%Y%m%d%H%M' ] ,
18
26
{ encoding : 'utf8' } ) ;
19
- if ( status !== 0 ) {
20
- common . skip ( 'File system appears to lack Y2K38 support' ) ;
27
+
28
+ assert . strictEqual ( dateResult . status , 0 ) ;
29
+ if ( dateResult . stdout . trim ( ) !== testFileDate ) {
30
+ common . skip ( 'File system appears to lack Y2k38 support (date failed)' ) ;
21
31
}
22
32
}
23
33
0 commit comments