From b899ab774bac0a9ec6f0232ba2aa164151844dc8 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 19 Oct 2023 12:46:04 +0000 Subject: [PATCH 1/3] benchmark: skip test-benchmark-os on IBMi - IBMi does not have the os.uptime implemented so skip otherwise CI tests fail. Signed-off-by: Michael Dawson --- benchmark/run.js | 11 ++++++++++- test/benchmark/benchmark.status | 3 --- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/benchmark/run.js b/benchmark/run.js index 0b63fb930bb000..d8298a144cd9d3 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -3,6 +3,7 @@ const path = require('path'); const fork = require('child_process').fork; const CLI = require('./_cli.js'); +const os = require('os'); const cli = new CLI(`usage: ./node run.js [options] [--] ... Run each benchmark in the directory a single time, more than one @@ -18,7 +19,15 @@ const cli = new CLI(`usage: ./node run.js [options] [--] ... matrix all each benchmark category is run one after the other `, { arrayArgs: ['set', 'filter', 'exclude'] }); -const benchmarks = cli.benchmarks(); +let benchmarks = cli.benchmarks(); + +// IBMi does not have working uptime so don't try to run +// that benchmark +if (os.type() === 'OS400') { + const index = benchmarks.indexOf('os/uptime.js'); + if (index != -1) + benchmarks.splice(index, 1); +} if (benchmarks.length === 0) { console.error('No benchmarks found'); diff --git a/test/benchmark/benchmark.status b/test/benchmark/benchmark.status index a1d5fdba756546..65e4d815552d3c 100644 --- a/test/benchmark/benchmark.status +++ b/test/benchmark/benchmark.status @@ -20,6 +20,3 @@ prefix benchmark [$arch==arm] -[$system==ibmi] -test-benchmark-os.js: SKIP - From 5bb8b879d7ea74adc75535ba59d320e242693d60 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 19 Oct 2023 13:38:04 +0000 Subject: [PATCH 2/3] squash: address linter issues Signed-off-by: Michael Dawson --- benchmark/run.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/run.js b/benchmark/run.js index d8298a144cd9d3..71afb1ead871c9 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -19,13 +19,13 @@ const cli = new CLI(`usage: ./node run.js [options] [--] ... matrix all each benchmark category is run one after the other `, { arrayArgs: ['set', 'filter', 'exclude'] }); -let benchmarks = cli.benchmarks(); +const benchmarks = cli.benchmarks(); // IBMi does not have working uptime so don't try to run // that benchmark if (os.type() === 'OS400') { const index = benchmarks.indexOf('os/uptime.js'); - if (index != -1) + if (index !== -1) benchmarks.splice(index, 1); } From 42c2df27978a1079d59f5f313704b06270b0d8c7 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 19 Oct 2023 20:05:36 +0000 Subject: [PATCH 3/3] squash: address comments Signed-off-by: Michael Dawson --- benchmark/os/uptime.js | 9 ++++++++- benchmark/run.js | 9 --------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/benchmark/os/uptime.js b/benchmark/os/uptime.js index 2f25dfe670b722..9826107c69d039 100644 --- a/benchmark/os/uptime.js +++ b/benchmark/os/uptime.js @@ -1,14 +1,21 @@ 'use strict'; +const os = require('os'); const common = require('../common.js'); -const uptime = require('os').uptime; const assert = require('assert'); +const uptime = os.uptime; + const bench = common.createBenchmark(main, { n: [1e5], }); function main({ n }) { + if (os.type() === 'OS400') { + console.log('Skipping: os.uptime is not implemented on IBMi'); + process.exit(0); + } + // Warm up. const length = 1024; const array = []; diff --git a/benchmark/run.js b/benchmark/run.js index 71afb1ead871c9..0b63fb930bb000 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -3,7 +3,6 @@ const path = require('path'); const fork = require('child_process').fork; const CLI = require('./_cli.js'); -const os = require('os'); const cli = new CLI(`usage: ./node run.js [options] [--] ... Run each benchmark in the directory a single time, more than one @@ -21,14 +20,6 @@ const cli = new CLI(`usage: ./node run.js [options] [--] ... `, { arrayArgs: ['set', 'filter', 'exclude'] }); const benchmarks = cli.benchmarks(); -// IBMi does not have working uptime so don't try to run -// that benchmark -if (os.type() === 'OS400') { - const index = benchmarks.indexOf('os/uptime.js'); - if (index !== -1) - benchmarks.splice(index, 1); -} - if (benchmarks.length === 0) { console.error('No benchmarks found'); process.exitCode = 1;