Skip to content

Commit

Permalink
test: only skip slow tests on Raspberry Pi devices
Browse files Browse the repository at this point in the history
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: #42645
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Stewart X Addison <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
richardlau authored and juanarbol committed May 31, 2022
1 parent c6d8503 commit 8a19abc
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 48 deletions.
23 changes: 15 additions & 8 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -790,6 +796,7 @@ const common = {
isMainThread,
isOpenBSD,
isOSX,
isPi,
isSunOS,
isWindows,
localIPv6Hosts,
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-crypto-dh-hash-modp18.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-crypto-dh-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-crypto-dh-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-dh-regr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-fs-watch-system-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-hash-seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-heapsnapshot-near-heap-limit-bounded.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-heapsnapshot-near-heap-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-net-bytes-per-incoming-chunk-overhead.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-next-tick-infinite-calls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-parent-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-parent-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-parent-no-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-worker-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-worker-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-policy-integrity-worker-no-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-repl-empty-maybelocal-crash.js
Original file line number Diff line number Diff line change
@@ -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'.
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-webcrypto-derivebits-pbkdf2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-child-process-pass-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 8a19abc

Please sign in to comment.