From c7dafd8958333126ba49789c314ee96e537fd452 Mon Sep 17 00:00:00 2001 From: Xu Meng Date: Fri, 6 Dec 2019 01:08:57 -0600 Subject: [PATCH] test: skip the unsupported test cases for IBM i This is a following PR of #30714. PR-URL: https://github.com/nodejs/node/pull/30819 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- test/async-hooks/test-fseventwrap.js | 3 +++ test/parallel/parallel.status | 9 +++++++++ test/parallel/test-c-ares.js | 3 ++- ...-child-process-spawnsync-validation-errors.js | 3 ++- test/parallel/test-child-process-uid-gid.js | 3 +++ ...cluster-shared-handle-bind-privileged-port.js | 3 +++ test/parallel/test-fs-access.js | 3 +++ .../test-fs-copyfile-respect-permissions.js | 3 +++ test/parallel/test-fs-options-immutable.js | 2 +- test/parallel/test-fs-utimes.js | 5 +++-- .../test-fs-watch-close-when-destroyed.js | 4 ++++ test/parallel/test-fs-watch-enoent.js | 4 ++++ test/parallel/test-fs-watch.js | 3 +++ test/parallel/test-memory-usage-emfile.js | 7 ++++++- test/parallel/test-memory-usage.js | 6 ++++-- test/parallel/test-module-loading-error.js | 8 ++++++-- test/parallel/test-net-pipe-connect-errors.js | 5 +++-- test/parallel/test-os-process-priority.js | 4 ++++ test/parallel/test-os.js | 16 +++++++++++----- test/parallel/test-process-euid-egid.js | 4 ++++ test/parallel/test-process-title-cli.js | 3 +++ test/parallel/test-setproctitle.js | 3 +++ test/parallel/test-trace-events-metadata.js | 3 ++- test/parallel/test-worker-memory.js | 3 +++ test/report/test-report-uv-handles.js | 3 +++ test/sequential/sequential.status | 6 ++++++ test/sequential/test-fs-watch.js | 2 ++ test/sequential/test-inspector-contexts.js | 6 +++--- tools/utils.py | 2 ++ 29 files changed, 108 insertions(+), 21 deletions(-) diff --git a/test/async-hooks/test-fseventwrap.js b/test/async-hooks/test-fseventwrap.js index 8608075c822ded..60928562872549 100644 --- a/test/async-hooks/test-fseventwrap.js +++ b/test/async-hooks/test-fseventwrap.js @@ -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(); diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index eea561b79b0ea5..741605f78b58bc 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -43,3 +43,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 diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 45e7d46829b00a..3b579bb7904af7 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -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)); diff --git a/test/parallel/test-child-process-spawnsync-validation-errors.js b/test/parallel/test-child-process-spawnsync-validation-errors.js index 9c8a409c752d04..22116e27d1ab98 100644 --- a/test/parallel/test-child-process-spawnsync-validation-errors.js +++ b/test/parallel/test-child-process-spawnsync-validation-errors.js @@ -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 }, diff --git a/test/parallel/test-child-process-uid-gid.js b/test/parallel/test-child-process-uid-gid.js index 621884cea627ea..748214294cebf8 100644 --- a/test/parallel/test-child-process-uid-gid.js +++ b/test/parallel/test-child-process-uid-gid.js @@ -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 }); diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index d8fae065fa15ff..31906bac30517d 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -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'); diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js index a4057dcb8352b6..1d281a7ca9608c 100644 --- a/test/parallel/test-fs-access.js +++ b/test/parallel/test-fs-access.js @@ -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'); diff --git a/test/parallel/test-fs-copyfile-respect-permissions.js b/test/parallel/test-fs-copyfile-respect-permissions.js index ae7829fba38d49..cb6774ef2abaee 100644 --- a/test/parallel/test-fs-copyfile-respect-permissions.js +++ b/test/parallel/test-fs-copyfile-respect-permissions.js @@ -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(); diff --git a/test/parallel/test-fs-options-immutable.js b/test/parallel/test-fs-options-immutable.js index 3555c82f1962f3..85e016f8347828 100644 --- a/test/parallel/test-fs-options-immutable.js +++ b/test/parallel/test-fs-options-immutable.js @@ -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(); } diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index e7a06c3661e84c..0f077150520302 100644 --- a/test/parallel/test-fs-utimes.js +++ b/test/parallel/test-fs-utimes.js @@ -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); diff --git a/test/parallel/test-fs-watch-close-when-destroyed.js b/test/parallel/test-fs-watch-close-when-destroyed.js index fb5239bc446eff..aee4d0e61f04da 100644 --- a/test/parallel/test-fs-watch-close-when-destroyed.js +++ b/test/parallel/test-fs-watch-close-when-destroyed.js @@ -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'); diff --git a/test/parallel/test-fs-watch-enoent.js b/test/parallel/test-fs-watch-enoent.js index 1ed9f2ed641f19..b76fa825e251a7 100644 --- a/test/parallel/test-fs-watch-enoent.js +++ b/test/parallel/test-fs-watch-enoent.js @@ -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'); diff --git a/test/parallel/test-fs-watch.js b/test/parallel/test-fs-watch.js index e596f32a766926..1d62a40a9b13a9 100644 --- a/test/parallel/test-fs-watch.js +++ b/test/parallel/test-fs-watch.js @@ -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'); diff --git a/test/parallel/test-memory-usage-emfile.js b/test/parallel/test-memory-usage-emfile.js index 98496e17b099d2..8dc1360d985bde 100644 --- a/test/parallel/test-memory-usage-emfile.js +++ b/test/parallel/test-memory-usage-emfile.js @@ -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'); diff --git a/test/parallel/test-memory-usage.js b/test/parallel/test-memory-usage.js index 4d9444805b0f08..08ef07a34627ca 100644 --- a/test/parallel/test-memory-usage.js +++ b/test/parallel/test-memory-usage.js @@ -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); diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 40b6de72a3299b..a4747aca4c5642 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -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 diff --git a/test/parallel/test-net-pipe-connect-errors.js b/test/parallel/test-net-pipe-connect-errors.js index 330203365e7fbe..fec4259b348dfb 100644 --- a/test/parallel/test-net-pipe-connect-errors.js +++ b/test/parallel/test-net-pipe-connect-errors.js @@ -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')); diff --git a/test/parallel/test-os-process-priority.js b/test/parallel/test-os-process-priority.js index 05686e6c77083a..ad73e022efdb90 100644 --- a/test/parallel/test-os-process-priority.js +++ b/test/parallel/test-os-process-priority.js @@ -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 { diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 9b86d3af8b263e..57b68ff8dea9ac 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -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); @@ -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'); diff --git a/test/parallel/test-process-euid-egid.js b/test/parallel/test-process-euid-egid.js index b9e0630dab5eca..3666b838b71a0e 100644 --- a/test/parallel/test-process-euid-egid.js +++ b/test/parallel/test-process-euid-egid.js @@ -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. diff --git a/test/parallel/test-process-title-cli.js b/test/parallel/test-process-title-cli.js index b6160fed1d0390..35d3693c0690e6 100644 --- a/test/parallel/test-process-title-cli.js +++ b/test/parallel/test-process-title-cli.js @@ -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 diff --git a/test/parallel/test-setproctitle.js b/test/parallel/test-setproctitle.js index 05bdfa578dde3f..ee146428a98f46 100644 --- a/test/parallel/test-setproctitle.js +++ b/test/parallel/test-setproctitle.js @@ -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'); diff --git a/test/parallel/test-trace-events-metadata.js b/test/parallel/test-trace-events-metadata.js index dbc8fc5d1ad5f9..ba700d6c9370ea 100644 --- a/test/parallel/test-trace-events-metadata.js +++ b/test/parallel/test-trace-events-metadata.js @@ -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) => diff --git a/test/parallel/test-worker-memory.js b/test/parallel/test-worker-memory.js index db204244a533d7..19b89d4321d6d7 100644 --- a/test/parallel/test-worker-memory.js +++ b/test/parallel/test-worker-memory.js @@ -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'); diff --git a/test/report/test-report-uv-handles.js b/test/report/test-report-uv-handles.js index 4d9bb12b44ff03..ea0c189b859c1a 100644 --- a/test/report/test-report-uv-handles.js +++ b/test/report/test-report-uv-handles.js @@ -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 diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status index 5c825b135c0db1..9fc935f00d96ab 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -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] diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index fd0788dac9b481..031e92c61c0b3c 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -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'); diff --git a/test/sequential/test-inspector-contexts.js b/test/sequential/test-inspector-contexts.js index 0918d22e90b931..8c7a68d4650d8a 100644 --- a/test/sequential/test-inspector-contexts.js +++ b/test/sequential/test-inspector-contexts.js @@ -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. diff --git a/tools/utils.py b/tools/utils.py index 014f3ac8667d02..9734836db7f06e 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -69,6 +69,8 @@ def GuessOS(): return 'freebsd' elif id == 'AIX': return 'aix' + elif id == 'OS400': + return 'ibmi' else: return None