test: only skip slow tests on Raspberry Pi devices

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 <midawson@redhat.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Stewart X Addison <sxa@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Richard Lau 2022-04-07 12:40:46 -04:00 committed by Michael Dawson
parent 7533d08b94
commit 73d53fe9f5
21 changed files with 55 additions and 48 deletions

View File

@ -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;
if (isPi)
return multipliers.two * ms; // Raspberry Pi devices
const armv = process.config.variables.arm_version;
if (armv === '7')
return multipliers.two * ms; // ARMv7
return ms; // ARMv8+
return ms;
}
let knownGlobals = [
@ -811,6 +817,7 @@ const common = {
isMainThread,
isOpenBSD,
isOSX,
isPi,
isSunOS,
isWindows,
localIPv6Hosts,

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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 {

View File

@ -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;

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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'.

View File

@ -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');

View File

@ -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');