From 0bb3c338077c010ee7f497544bac1aba8dadc75e Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 7 Apr 2022 12:40:46 -0400 Subject: [PATCH] test: only skip slow tests on Raspberry Pi devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detect the Raspberry Pi devices in the Node.js CI and only skip the slow tests on those instead of all armv7l devices. PR-URL: https://github.com/nodejs/node/pull/42645 Reviewed-By: Michael Dawson Reviewed-By: Tobias Nießen Reviewed-By: Stewart X Addison Reviewed-By: Darshan Sen --- test/common/index.js | 23 ++++++++++++------- test/pummel/test-crypto-dh-hash-modp18.js | 4 ++-- test/pummel/test-crypto-dh-hash.js | 4 ++-- test/pummel/test-crypto-dh-keys.js | 4 ++-- test/pummel/test-dh-regr.js | 4 ++-- test/pummel/test-fs-watch-system-limit.js | 4 ++-- test/pummel/test-hash-seed.js | 4 ++-- ...st-heapsnapshot-near-heap-limit-bounded.js | 4 ++-- .../test-heapsnapshot-near-heap-limit.js | 4 ++-- ...t-net-bytes-per-incoming-chunk-overhead.js | 4 ++-- test/pummel/test-next-tick-infinite-calls.js | 4 ++-- test/pummel/test-policy-integrity-dep.js | 4 ++-- .../test-policy-integrity-parent-commonjs.js | 4 ++-- .../test-policy-integrity-parent-module.js | 4 ++-- ...policy-integrity-parent-no-package-json.js | 4 ++-- .../test-policy-integrity-worker-commonjs.js | 4 ++-- .../test-policy-integrity-worker-module.js | 4 ++-- ...policy-integrity-worker-no-package-json.js | 4 ++-- .../test-repl-empty-maybelocal-crash.js | 4 ++-- .../test-webcrypto-derivebits-pbkdf2.js | 4 ++-- test/sequential/test-child-process-pass-fd.js | 4 ++-- 21 files changed, 55 insertions(+), 48 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index 29e17615cc21ef..d2b23a6570f562 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -120,6 +120,17 @@ const isFreeBSD = process.platform === 'freebsd'; const isOpenBSD = process.platform === 'openbsd'; const isLinux = process.platform === 'linux'; const isOSX = process.platform === 'darwin'; +const isPi = (() => { + try { + // Normal Raspberry Pi detection is to find the `Raspberry Pi` string in + // the contents of `/sys/firmware/devicetree/base/model` but that doesn't + // work inside a container. Match the chipset model number instead. + const cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }); + return /^Hardware\s*:\s*(.*)$/im.exec(cpuinfo)?.[1] === 'BCM2835'; + } catch { + return false; + } +})(); const isDumbTerminal = process.env.TERM === 'dumb'; @@ -246,15 +257,10 @@ function platformTimeout(ms) { if (isAIX) return multipliers.two * ms; // Default localhost speed is slower on AIX - if (process.arch !== 'arm') - return ms; - - const armv = process.config.variables.arm_version; - - if (armv === '7') - return multipliers.two * ms; // ARMv7 + if (isPi) + return multipliers.two * ms; // Raspberry Pi devices - return ms; // ARMv8+ + return ms; } let knownGlobals = [ @@ -811,6 +817,7 @@ const common = { isMainThread, isOpenBSD, isOSX, + isPi, isSunOS, isWindows, localIPv6Hosts, diff --git a/test/pummel/test-crypto-dh-hash-modp18.js b/test/pummel/test-crypto-dh-hash-modp18.js index e2a7f43c45074d..ceb4cbd885c464 100644 --- a/test/pummel/test-crypto-dh-hash-modp18.js +++ b/test/pummel/test-crypto-dh-hash-modp18.js @@ -26,8 +26,8 @@ if (!common.hasCrypto) { common.skip('node compiled without OpenSSL.'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); diff --git a/test/pummel/test-crypto-dh-hash.js b/test/pummel/test-crypto-dh-hash.js index a5932eb764792f..3ad974ff329efd 100644 --- a/test/pummel/test-crypto-dh-hash.js +++ b/test/pummel/test-crypto-dh-hash.js @@ -26,8 +26,8 @@ if (!common.hasCrypto) { common.skip('node compiled without OpenSSL.'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); diff --git a/test/pummel/test-crypto-dh-keys.js b/test/pummel/test-crypto-dh-keys.js index 99be0e517fd640..2caa4e244a9859 100644 --- a/test/pummel/test-crypto-dh-keys.js +++ b/test/pummel/test-crypto-dh-keys.js @@ -26,8 +26,8 @@ if (!common.hasCrypto) { common.skip('node compiled without OpenSSL.'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index 87136a0afeb23d..76686d22a3c7e0 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -26,8 +26,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); diff --git a/test/pummel/test-fs-watch-system-limit.js b/test/pummel/test-fs-watch-system-limit.js index 20995c514fa569..3486f5372b8d5d 100644 --- a/test/pummel/test-fs-watch-system-limit.js +++ b/test/pummel/test-fs-watch-system-limit.js @@ -9,8 +9,8 @@ if (!common.isLinux) { common.skip('The fs watch limit is OS-dependent'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } try { diff --git a/test/pummel/test-hash-seed.js b/test/pummel/test-hash-seed.js index 42b626b079e873..274183d8ce977e 100644 --- a/test/pummel/test-hash-seed.js +++ b/test/pummel/test-hash-seed.js @@ -3,8 +3,8 @@ // Check that spawn child doesn't create duplicated entries const common = require('../common'); -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const kRepetitions = 2; diff --git a/test/pummel/test-heapsnapshot-near-heap-limit-bounded.js b/test/pummel/test-heapsnapshot-near-heap-limit-bounded.js index faf5c4755aac75..dd7497d975ab92 100644 --- a/test/pummel/test-heapsnapshot-near-heap-limit-bounded.js +++ b/test/pummel/test-heapsnapshot-near-heap-limit-bounded.js @@ -2,8 +2,8 @@ const common = require('../common'); -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const tmpdir = require('../common/tmpdir'); diff --git a/test/pummel/test-heapsnapshot-near-heap-limit.js b/test/pummel/test-heapsnapshot-near-heap-limit.js index 420ba04205945b..1af4e61e08c028 100644 --- a/test/pummel/test-heapsnapshot-near-heap-limit.js +++ b/test/pummel/test-heapsnapshot-near-heap-limit.js @@ -2,8 +2,8 @@ const common = require('../common'); -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const tmpdir = require('../common/tmpdir'); diff --git a/test/pummel/test-net-bytes-per-incoming-chunk-overhead.js b/test/pummel/test-net-bytes-per-incoming-chunk-overhead.js index f556e9881f728c..b3613110ab5c54 100644 --- a/test/pummel/test-net-bytes-per-incoming-chunk-overhead.js +++ b/test/pummel/test-net-bytes-per-incoming-chunk-overhead.js @@ -7,8 +7,8 @@ if (process.config.variables.asan) { common.skip('ASAN messes with memory measurements'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); diff --git a/test/pummel/test-next-tick-infinite-calls.js b/test/pummel/test-next-tick-infinite-calls.js index bf837f5ebc92c0..d1131066977ea2 100644 --- a/test/pummel/test-next-tick-infinite-calls.js +++ b/test/pummel/test-next-tick-infinite-calls.js @@ -22,8 +22,8 @@ 'use strict'; const common = require('../common'); -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } let complete = 0; diff --git a/test/pummel/test-policy-integrity-dep.js b/test/pummel/test-policy-integrity-dep.js index ec58462335cd56..02f24d02a23544 100644 --- a/test/pummel/test-policy-integrity-dep.js +++ b/test/pummel/test-policy-integrity-dep.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-policy-integrity-parent-commonjs.js b/test/pummel/test-policy-integrity-parent-commonjs.js index 39febab73ee419..425abe38ebd9fb 100644 --- a/test/pummel/test-policy-integrity-parent-commonjs.js +++ b/test/pummel/test-policy-integrity-parent-commonjs.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-policy-integrity-parent-module.js b/test/pummel/test-policy-integrity-parent-module.js index e60a606ea32bbe..dda800dc3652fc 100644 --- a/test/pummel/test-policy-integrity-parent-module.js +++ b/test/pummel/test-policy-integrity-parent-module.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-policy-integrity-parent-no-package-json.js b/test/pummel/test-policy-integrity-parent-no-package-json.js index f2208744447827..a722263e1e484a 100644 --- a/test/pummel/test-policy-integrity-parent-no-package-json.js +++ b/test/pummel/test-policy-integrity-parent-no-package-json.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-policy-integrity-worker-commonjs.js b/test/pummel/test-policy-integrity-worker-commonjs.js index 22a7d762466046..b5d49222a2f01c 100644 --- a/test/pummel/test-policy-integrity-worker-commonjs.js +++ b/test/pummel/test-policy-integrity-worker-commonjs.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-policy-integrity-worker-module.js b/test/pummel/test-policy-integrity-worker-module.js index e5d4e4cd45d300..a8a4fb2c29589f 100644 --- a/test/pummel/test-policy-integrity-worker-module.js +++ b/test/pummel/test-policy-integrity-worker-module.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-policy-integrity-worker-no-package-json.js b/test/pummel/test-policy-integrity-worker-no-package-json.js index 808687f40ea219..e5b3e3ccfabbf6 100644 --- a/test/pummel/test-policy-integrity-worker-no-package-json.js +++ b/test/pummel/test-policy-integrity-worker-no-package-json.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } common.requireNoPackageJSONAbove(); diff --git a/test/pummel/test-repl-empty-maybelocal-crash.js b/test/pummel/test-repl-empty-maybelocal-crash.js index 84686e308c6157..c2428508befe7b 100644 --- a/test/pummel/test-repl-empty-maybelocal-crash.js +++ b/test/pummel/test-repl-empty-maybelocal-crash.js @@ -1,8 +1,8 @@ 'use strict'; const common = require('../common'); -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } // The process should not crash when the REPL receives the string, 'ss'. diff --git a/test/pummel/test-webcrypto-derivebits-pbkdf2.js b/test/pummel/test-webcrypto-derivebits-pbkdf2.js index 512662025c66f7..e7ed4f6bd646dd 100644 --- a/test/pummel/test-webcrypto-derivebits-pbkdf2.js +++ b/test/pummel/test-webcrypto-derivebits-pbkdf2.js @@ -6,8 +6,8 @@ if (!common.hasCrypto) { common.skip('missing crypto'); } -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); diff --git a/test/sequential/test-child-process-pass-fd.js b/test/sequential/test-child-process-pass-fd.js index ad4e5d693ee2e5..86092f56da8565 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -9,8 +9,8 @@ const common = require('../common'); // This test is basically `test-cluster-net-send` but creating lots of workers // so the issue reproduces on OS X consistently. -if (process.config.variables.arm_version === '7') { - common.skip('Too slow for armv7 bots'); +if (common.isPi) { + common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert');