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.
  • Loading branch information
richardlau committed Apr 7, 2022
1 parent 44fdf95 commit 574d013
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 46 deletions.
23 changes: 15 additions & 8 deletions test/common/index.js
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 @@ -811,6 +817,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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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-webcrypto-derivebits-pbkdf2.js
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
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 574d013

Please sign in to comment.