Skip to content

Commit 035e063

Browse files
richardlaunodejs-github-bot
authored andcommitted
test: disambiguate AIX and IBM i
When built with Python 3.9 on IBM i, `process.platform` will return `os400` instead of `aix`. In preparation for this, make `common.isAIX` only return true for AIX and update the tests to add checks for `common.isIBMi` where they were missing. PR-URL: #48056 Refs: #46739 Refs: nodejs/build#3358 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 53b5545 commit 035e063

13 files changed

+25
-18
lines changed

test/abort/test-addon-uv-handle-leak.js

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if (process.argv[2] === 'child') {
7878

7979
if (!(common.isFreeBSD ||
8080
common.isAIX ||
81+
common.isIBMi ||
8182
(common.isLinux && !isGlibc()) ||
8283
common.isWindows)) {
8384
assert(stderr.includes('ExampleOwnerClass'), stderr);

test/common/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ if (process.argv.length === 2 &&
123123
}
124124

125125
const isWindows = process.platform === 'win32';
126-
const isAIX = process.platform === 'aix';
127126
const isSunOS = process.platform === 'sunos';
128127
const isFreeBSD = process.platform === 'freebsd';
129128
const isOpenBSD = process.platform === 'openbsd';
@@ -274,7 +273,7 @@ function platformTimeout(ms) {
274273
if (process.features.debug)
275274
ms = multipliers.two * ms;
276275

277-
if (isAIX)
276+
if (exports.isAIX || exports.isIBMi)
278277
return multipliers.two * ms; // Default localhost speed is slower on AIX
279278

280279
if (isPi)
@@ -928,7 +927,6 @@ const common = {
928927
hasQuic,
929928
hasMultiLocalhost,
930929
invalidArgTypeHelper,
931-
isAIX,
932930
isAlive,
933931
isAsan,
934932
isDumbTerminal,
@@ -999,7 +997,12 @@ const common = {
999997
},
1000998

1001999
// On IBMi, process.platform and os.platform() both return 'aix',
1000+
// when built with Python versions earlier than 3.9.
10021001
// It is not enough to differentiate between IBMi and real AIX system.
1002+
get isAIX() {
1003+
return require('os').type() === 'AIX';
1004+
},
1005+
10031006
get isIBMi() {
10041007
return require('os').type() === 'OS400';
10051008
},

test/known_issues/test-cwd-enoent-file.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const common = require('../common');
66
const assert = require('assert');
77

8-
if (common.isSunOS || common.isWindows || common.isAIX) {
8+
if (common.isSunOS || common.isWindows || common.isAIX || common.isIBMi) {
99
// The current working directory cannot be removed on these platforms.
1010
// Change this to common.skip() when this is no longer a known issue test.
1111
assert.fail('cannot rmdir current working directory');

test/parallel/test-cwd-enoent-preload.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const common = require('../common');
33
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
4-
if (common.isSunOS || common.isWindows || common.isAIX)
4+
if (common.isSunOS || common.isWindows || common.isAIX || common.isIBMi)
55
common.skip('cannot rmdir current working directory');
66
if (!common.isMainThread)
77
common.skip('process.chdir is not available in Workers');

test/parallel/test-cwd-enoent-repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const common = require('../common');
33
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
4-
if (common.isSunOS || common.isWindows || common.isAIX)
4+
if (common.isSunOS || common.isWindows || common.isAIX || common.isIBMi)
55
common.skip('cannot rmdir current working directory');
66
if (!common.isMainThread)
77
common.skip('process.chdir is not available in Workers');

test/parallel/test-cwd-enoent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const common = require('../common');
33
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
4-
if (common.isSunOS || common.isWindows || common.isAIX)
4+
if (common.isSunOS || common.isWindows || common.isAIX || common.isIBMi)
55
common.skip('cannot rmdir current working directory');
66
if (!common.isMainThread)
77
common.skip('process.chdir is not available in Workers');

test/parallel/test-fs-readfile-pipe-large.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common');
33

44
// Simulate `cat readfile.js | node readfile.js`
55

6-
if (common.isWindows || common.isAIX)
6+
if (common.isWindows || common.isAIX || common.isIBMi)
77
common.skip(`No /dev/stdin on ${process.platform}.`);
88

99
const assert = require('assert');

test/parallel/test-fs-readfile-pipe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const common = require('../common');
2424

2525
// Simulate `cat readfile.js | node readfile.js`
2626

27-
if (common.isWindows || common.isAIX)
27+
if (common.isWindows || common.isAIX || common.isIBMi)
2828
common.skip(`No /dev/stdin on ${process.platform}.`);
2929

3030
const assert = require('assert');

test/parallel/test-fs-readfilesync-pipe-large.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common');
33

44
// Simulate `cat readfile.js | node readfile.js`
55

6-
if (common.isWindows || common.isAIX)
6+
if (common.isWindows || common.isAIX || common.isIBMi)
77
common.skip(`No /dev/stdin on ${process.platform}.`);
88

99
const assert = require('assert');

test/parallel/test-fs-realpath-pipe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const common = require('../common');
44

5-
if (common.isWindows || common.isAIX)
5+
if (common.isWindows || common.isAIX || common.isIBMi)
66
common.skip(`No /dev/stdin on ${process.platform}.`);
77

88
const assert = require('assert');

test/parallel/test-fs-utimes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function stat_resource(resource, statSync = fs.statSync) {
3939
const stats = fs.fstatSync(resource);
4040
// Ensure mtime has been written to disk
4141
// except for directories on AIX where it cannot be synced
42-
if (common.isAIX && stats.isDirectory())
42+
if ((common.isAIX || common.isIBMi) && stats.isDirectory())
4343
return stats;
4444
fs.fsyncSync(resource);
4545
return fs.fstatSync(resource);

test/parallel/test-os.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,14 @@ const hostname = os.hostname();
8181
is.string(hostname);
8282
assert.ok(hostname.length > 0);
8383

84-
const DUMMY_PRIORITY = 10;
85-
os.setPriority(DUMMY_PRIORITY);
86-
const priority = os.getPriority();
87-
is.number(priority);
88-
assert.strictEqual(priority, DUMMY_PRIORITY);
84+
// IBMi process priority is different.
85+
if (!common.isIBMi) {
86+
const DUMMY_PRIORITY = 10;
87+
os.setPriority(DUMMY_PRIORITY);
88+
const priority = os.getPriority();
89+
is.number(priority);
90+
assert.strictEqual(priority, DUMMY_PRIORITY);
91+
}
8992

9093
// On IBMi, os.uptime() returns 'undefined'
9194
if (!common.isIBMi) {

test/parallel/test-process-dlopen-error-message-crash.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ assert.throws(() => {
1717
}, ({ name, code, message }) => {
1818
assert.strictEqual(name, 'Error');
1919
assert.strictEqual(code, 'ERR_DLOPEN_FAILED');
20-
if (!common.isAIX) {
20+
if (!common.isAIX && !common.isIBMi) {
2121
assert.match(message, /foo-%s\.node/);
2222
}
2323
return true;

0 commit comments

Comments
 (0)