Skip to content

Commit

Permalink
test: skip the unsupported test cases for IBM i
Browse files Browse the repository at this point in the history
This is a following PR of #30714.

PR-URL: #30819
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
dmabupt authored and BridgeAR committed Jan 3, 2020
1 parent 60dd183 commit e28e873
Show file tree
Hide file tree
Showing 29 changed files with 108 additions and 21 deletions.
3 changes: 3 additions & 0 deletions test/async-hooks/test-fseventwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const fs = require('fs');
if (!common.isMainThread)
common.skip('Worker bootstrapping works differently -> different async IDs');

if (common.isIBMi)
common.skip('IBMi does not suppport fs.watch()');

const hooks = initHooks();

hooks.enable();
Expand Down
9 changes: 9 additions & 0 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ test-async-hooks-http-parser-destroy: PASS,FLAKY
[$system==freebsd]

[$system==aix]

[$system==ibmi]
# https://github.com/nodejs/node/pull/30819
test-child-process-fork-net-server: SKIP
test-cli-node-options: SKIP
test-cluster-shared-leak: SKIP
test-http-writable-true-after-close: SKIP
test-http2-connect-method: SKIP
test-net-error-twice: SKIP
3 changes: 2 additions & 1 deletion test/parallel/test-c-ares.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ dns.lookup('::1', common.mustCall((error, result, addressType) => {
// Windows doesn't usually have an entry for localhost 127.0.0.1 in
// C:\Windows\System32\drivers\etc\hosts
// so we disable this test on Windows.
if (!common.isWindows) {
// IBMi reports `ENOTFOUND` when get hostname by address 127.0.0.1
if (!common.isWindows && !common.isIBMi) {
dns.reverse('127.0.0.1', common.mustCall(function(error, domains) {
assert.ifError(error);
assert.ok(Array.isArray(domains));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const common = require('../common');
const assert = require('assert');
const spawnSync = require('child_process').spawnSync;
const signals = require('os').constants.signals;
const rootUser = common.isWindows ? false : process.getuid() === 0;
const rootUser = common.isWindows ? false :
common.isIBMi ? true : process.getuid() === 0;

const invalidArgTypeError = common.expectsError(
{ code: 'ERR_INVALID_ARG_TYPE', type: TypeError },
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-child-process-uid-gid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const assert = require('assert');
const spawn = require('child_process').spawn;
const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/;

if (common.isIBMi)
common.skip('IBMi has a different behavior');

if (common.isWindows || process.getuid() !== 0) {
assert.throws(() => {
spawn('echo', ['fhqwhgads'], { uid: 0 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const common = require('../common');
if (common.isOSX)
common.skip('macOS may allow ordinary processes to use any port');

if (common.isIBMi)
common.skip('IBMi may allow ordinary processes to use any port');

if (common.isWindows)
common.skip('not reliable on Windows');

Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-fs-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const common = require('../common');
if (!common.isWindows && process.getuid() === 0)
common.skip('as this test should not be run as `root`');

if (common.isIBMi)
common.skip('IBMi has a different access permission mechanism');

const assert = require('assert');
const fs = require('fs');
const path = require('path');
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-fs-copyfile-respect-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const common = require('../common');
if (!common.isWindows && process.getuid() === 0)
common.skip('as this test should not be run as `root`');

if (common.isIBMi)
common.skip('IBMi has a different access permission mechanism');

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-fs-options-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (common.canCreateSymLink()) {
fs.appendFile(fileName, 'ABCD', options, common.mustCall(errHandler));
}

{
if (!common.isIBMi) { // IBMi does not suppport fs.watch()
const watch = fs.watch(__filename, options, common.mustNotCall());
watch.close();
}
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-fs-utimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ function runTests(iter) {
const path = `${tmpdir.path}/test-utimes-precision`;
fs.writeFileSync(path, '');

// Test Y2K38 for all platforms [except 'arm', 'OpenBSD' and 'SunOS']
if (!process.arch.includes('arm') && !common.isOpenBSD && !common.isSunOS) {
// Test Y2K38 for all platforms [except 'arm', 'OpenBSD', 'SunOS' and 'IBMi']
if (!process.arch.includes('arm') &&
!common.isOpenBSD && !common.isSunOS && !common.isIBMi) {
const Y2K38_mtime = 2 ** 31;
fs.utimesSync(path, Y2K38_mtime, Y2K38_mtime);
const Y2K38_stats = fs.statSync(path);
Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-fs-watch-close-when-destroyed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// already destroyed will result in a noop instead of a crash.

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

if (common.isIBMi)
common.skip('IBMi does not support `fs.watch()`');

const tmpdir = require('../common/tmpdir');
const fs = require('fs');
const path = require('path');
Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-fs-watch-enoent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// This verifies the error thrown by fs.watch.

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

if (common.isIBMi)
common.skip('IBMi does not support `fs.watch()`');

const assert = require('assert');
const fs = require('fs');
const tmpdir = require('../common/tmpdir');
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-fs-watch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';
const common = require('../common');

if (common.isIBMi)
common.skip('IBMi does not support `fs.watch()`');

// Tests if `filename` is provided to watcher on supported platforms

const fs = require('fs');
Expand Down
7 changes: 6 additions & 1 deletion test/parallel/test-memory-usage-emfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict';
require('../common');
const common = require('../common');

// On IBMi, the rss memory always returns zero
if (common.isIBMi)
common.skip('On IBMi, the rss memory always returns zero');

const assert = require('assert');

const fs = require('fs');
Expand Down
6 changes: 4 additions & 2 deletions test/parallel/test-memory-usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');

const r = process.memoryUsage();
assert.ok(r.rss > 0);
// On IBMi, the rss memory always returns zero
if (!common.isIBMi)
assert.ok(r.rss > 0);
assert.ok(r.heapTotal > 0);
assert.ok(r.heapUsed > 0);
assert.ok(r.external > 0);
8 changes: 6 additions & 2 deletions test/parallel/test-module-loading-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ const errorMessagesByPlatform = {
darwin: ['file too short'],
aix: ['Cannot load module',
'Cannot run a file that does not have a valid format.',
'Exec format error']
'Exec format error'],
ibmi: ['Cannot load module',
'The module has too many section headers',
'or the file has been truncated.'],
};
// If we don't know a priori what the error would be, we accept anything.
const errorMessages = errorMessagesByPlatform[process.platform] || [''];
const platform = common.isIBMi ? 'ibmi' : process.platform;
const errorMessages = errorMessagesByPlatform[platform] || [''];

// On Windows, error messages are MUI dependent
// Ref: https://github.com/nodejs/node/issues/13376
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-net-pipe-connect-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ noEntSocketClient.on('error', common.mustCall(function(err) {
}));


// On Windows or when running as root, a chmod has no effect on named pipes
if (!common.isWindows && process.getuid() !== 0) {
// On Windows or IBMi or when running as root,
// a chmod has no effect on named pipes
if (!common.isWindows && !common.isIBMi && process.getuid() !== 0) {
// Trying to connect to a socket one has no access to should result in EACCES
const accessServer = net.createServer(
common.mustNotCall('server callback should not run'));
Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-os-process-priority.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';
const common = require('../common');
// IBMi process priority is different.
if (common.isIBMi)
common.skip('IBMi has a different process priority');

const assert = require('assert');
const os = require('os');
const {
Expand Down
16 changes: 11 additions & 5 deletions test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ const hostname = os.hostname();
is.string(hostname);
assert.ok(hostname.length > 0);

const uptime = os.uptime();
is.number(uptime);
assert.ok(uptime > 0);
// On IBMi, os.uptime() returns 'undefined'
if (!common.isIBMi) {
const uptime = os.uptime();
is.number(uptime);
assert.ok(uptime > 0);
}

const cpus = os.cpus();
is.array(cpus);
Expand Down Expand Up @@ -244,8 +247,11 @@ assert.strictEqual(`${os.platform}`, os.platform());
assert.strictEqual(+os.totalmem, os.totalmem());

// Assert that the following values are coercible to numbers.
is.number(+os.uptime, 'uptime');
is.number(os.uptime(), 'uptime');
// On IBMi, os.uptime() returns 'undefined'
if (!common.isIBMi) {
is.number(+os.uptime, 'uptime');
is.number(os.uptime(), 'uptime');
}

is.number(+os.freemem, 'freemem');
is.number(os.freemem(), 'freemem');
4 changes: 4 additions & 0 deletions test/parallel/test-process-euid-egid.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ assert.throws(() => {
message: 'User identifier does not exist: fhqwhgadshgnsdhjsdbkhsdabkfabkveyb'
});

// IBMi does not support below operations.
if (common.isIBMi)
return;

// If we're not running as super user...
if (process.getuid() !== 0) {
// Should not throw.
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-process-title-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const common = require('../common');
if (common.isSunOS)
common.skip(`Unsupported platform [${process.platform}]`);

if (common.isIBMi)
common.skip('Unsupported platform IBMi');

const assert = require('assert');

// Verifies that the --title=foo command line flag set the process
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-setproctitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const common = require('../common');
// FIXME add sunos support
if (common.isSunOS)
common.skip(`Unsupported platform [${process.platform}]`);
// FIXME add IBMi support
if (common.isIBMi)
common.skip('Unsupported platform IBMi');
if (!common.isMainThread)
common.skip('Setting the process title from Workers is not supported');

Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-trace-events-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ proc.once('exit', common.mustCall(() => {
(!process.release.lts ||
trace.args.process.release.lts === process.release.lts)));

if (!common.isSunOS) {
if (!common.isSunOS && !common.isIBMi) {
// Changing process.title is currently unsupported on SunOS/SmartOS
// and IBMi
assert(traces.some((trace) =>
trace.name === 'process_name' && trace.args.name === 'foo'));
assert(traces.some((trace) =>
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-worker-memory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict';
const common = require('../common');
if (common.isIBMi)
common.skip('On IBMi, the rss memory always returns zero');

const assert = require('assert');
const util = require('util');
const { Worker } = require('worker_threads');
Expand Down
3 changes: 3 additions & 0 deletions test/report/test-report-uv-handles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// Testcase to check reporting of uv handles.
const common = require('../common');
if (common.isIBMi)
common.skip('IBMi does not support fs.watch()');

common.skipIfReportDisabled();
if (process.argv[2] === 'child') {
// Exit on loss of parent process
Expand Down
6 changes: 6 additions & 0 deletions test/sequential/sequential.status
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ test-worker-prof: PASS, FLAKY
# https://github.com/nodejs/node/pull/29054
test-buffer-creation-regression: SKIP

[$system==ibmi]
# https://github.com/nodejs/node/pull/29054
test-buffer-creation-regression: SKIP
# https://github.com/nodejs/node/pull/30819
test-perf-hooks: SKIP

[$arch==arm]
2 changes: 2 additions & 0 deletions test/sequential/test-fs-watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

'use strict';
const common = require('../common');
if (common.isIBMi)
common.skip('IBMi does not support fs.watch()');

const assert = require('assert');
const fs = require('fs');
Expand Down
6 changes: 3 additions & 3 deletions test/sequential/test-inspector-contexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ async function testContextCreatedAndDestroyed() {
session.post('Runtime.enable', assert.ifError);
const contextCreated = await mainContextPromise;
const { name, origin, auxData } = contextCreated.params.context;
if (common.isSunOS || common.isWindows) {
// uv_get_process_title() is unimplemented on Solaris-likes, it returns
// an empty string. On the Windows CI buildbots it returns
if (common.isSunOS || common.isWindows || common.isIBMi) {
// uv_get_process_title() is unimplemented on Solaris-likes and IBMi,
// it returns an empty string. On the Windows CI buildbots it returns
// "Administrator: Windows PowerShell[42]" because of a GetConsoleTitle()
// quirk. Not much we can do about either, just verify that it contains
// the PID.
Expand Down
2 changes: 2 additions & 0 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def GuessOS():
return 'freebsd'
elif id == 'AIX':
return 'aix'
elif id == 'OS400':
return 'ibmi'
else:
return None

Expand Down

0 comments on commit e28e873

Please sign in to comment.