Skip to content

Commit 626728a

Browse files
committed
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.
1 parent 44fdf95 commit 626728a

20 files changed

+54
-46
lines changed

test/common/index.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ const isFreeBSD = process.platform === 'freebsd';
120120
const isOpenBSD = process.platform === 'openbsd';
121121
const isLinux = process.platform === 'linux';
122122
const isOSX = process.platform === 'darwin';
123+
const isPi = (() => {
124+
try {
125+
// Normal Raspberry Pi detection is to find the `Raspberry Pi` string in
126+
// the contents of `/sys/firmware/devicetree/base/model` but that doesn't
127+
// work inside a container. Match the chipset model number instead.
128+
const cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' });
129+
return /^Hardware\s*:\s*(.*)$/im.exec(cpuinfo)?.[1] === 'BCM2835';
130+
} catch {
131+
return false;
132+
}
133+
return false;
134+
})();
123135

124136
const isDumbTerminal = process.env.TERM === 'dumb';
125137

@@ -246,15 +258,10 @@ function platformTimeout(ms) {
246258
if (isAIX)
247259
return multipliers.two * ms; // Default localhost speed is slower on AIX
248260

249-
if (process.arch !== 'arm')
250-
return ms;
251-
252-
const armv = process.config.variables.arm_version;
253-
254-
if (armv === '7')
255-
return multipliers.two * ms; // ARMv7
261+
if (isPi)
262+
return multipliers.two * ms; // Raspberry Pi devices
256263

257-
return ms; // ARMv8+
264+
return ms;
258265
}
259266

260267
let knownGlobals = [
@@ -811,6 +818,7 @@ const common = {
811818
isMainThread,
812819
isOpenBSD,
813820
isOSX,
821+
isPi,
814822
isSunOS,
815823
isWindows,
816824
localIPv6Hosts,

test/pummel/test-crypto-dh-hash-modp18.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ if (!common.hasCrypto) {
2626
common.skip('node compiled without OpenSSL.');
2727
}
2828

29-
if (process.config.variables.arm_version === '7') {
30-
common.skip('Too slow for armv7 bots');
29+
if (common.isPi) {
30+
common.skip('Too slow for Raspberry Pi devices');
3131
}
3232

3333
const assert = require('assert');

test/pummel/test-crypto-dh-hash.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ if (!common.hasCrypto) {
2626
common.skip('node compiled without OpenSSL.');
2727
}
2828

29-
if (process.config.variables.arm_version === '7') {
30-
common.skip('Too slow for armv7 bots');
29+
if (common.isPi) {
30+
common.skip('Too slow for Raspberry Pi devices');
3131
}
3232

3333
const assert = require('assert');

test/pummel/test-crypto-dh-keys.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ if (!common.hasCrypto) {
2626
common.skip('node compiled without OpenSSL.');
2727
}
2828

29-
if (process.config.variables.arm_version === '7') {
30-
common.skip('Too slow for armv7 bots');
29+
if (common.isPi) {
30+
common.skip('Too slow for Raspberry Pi devices');
3131
}
3232

3333
const assert = require('assert');

test/pummel/test-dh-regr.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ if (!common.hasCrypto) {
2626
common.skip('missing crypto');
2727
}
2828

29-
if (process.config.variables.arm_version === '7') {
30-
common.skip('Too slow for armv7 bots');
29+
if (common.isPi) {
30+
common.skip('Too slow for Raspberry Pi devices');
3131
}
3232

3333
const assert = require('assert');

test/pummel/test-fs-watch-system-limit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ if (!common.isLinux) {
99
common.skip('The fs watch limit is OS-dependent');
1010
}
1111

12-
if (process.config.variables.arm_version === '7') {
13-
common.skip('Too slow for armv7 bots');
12+
if (common.isPi) {
13+
common.skip('Too slow for Raspberry Pi devices');
1414
}
1515

1616
try {

test/pummel/test-hash-seed.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// Check that spawn child doesn't create duplicated entries
44
const common = require('../common');
55

6-
if (process.config.variables.arm_version === '7') {
7-
common.skip('Too slow for armv7 bots');
6+
if (common.isPi) {
7+
common.skip('Too slow for Raspberry Pi devices');
88
}
99

1010
const kRepetitions = 2;

test/pummel/test-heapsnapshot-near-heap-limit-bounded.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
const common = require('../common');
44

5-
if (process.config.variables.arm_version === '7') {
6-
common.skip('Too slow for armv7 bots');
5+
if (common.isPi) {
6+
common.skip('Too slow for Raspberry Pi devices');
77
}
88

99
const tmpdir = require('../common/tmpdir');

test/pummel/test-heapsnapshot-near-heap-limit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
const common = require('../common');
44

5-
if (process.config.variables.arm_version === '7') {
6-
common.skip('Too slow for armv7 bots');
5+
if (common.isPi) {
6+
common.skip('Too slow for Raspberry Pi devices');
77
}
88

99
const tmpdir = require('../common/tmpdir');

test/pummel/test-net-bytes-per-incoming-chunk-overhead.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ if (process.config.variables.asan) {
77
common.skip('ASAN messes with memory measurements');
88
}
99

10-
if (process.config.variables.arm_version === '7') {
11-
common.skip('Too slow for armv7 bots');
10+
if (common.isPi) {
11+
common.skip('Too slow for Raspberry Pi devices');
1212
}
1313

1414
const assert = require('assert');

test/pummel/test-next-tick-infinite-calls.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
'use strict';
2323
const common = require('../common');
2424

25-
if (process.config.variables.arm_version === '7') {
26-
common.skip('Too slow for armv7 bots');
25+
if (common.isPi) {
26+
common.skip('Too slow for Raspberry Pi devices');
2727
}
2828

2929
let complete = 0;

test/pummel/test-policy-integrity-dep.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-policy-integrity-parent-commonjs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-policy-integrity-parent-module.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-policy-integrity-parent-no-package-json.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-policy-integrity-worker-commonjs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-policy-integrity-worker-module.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-policy-integrity-worker-no-package-json.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
common.requireNoPackageJSONAbove();

test/pummel/test-webcrypto-derivebits-pbkdf2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
}
88

9-
if (process.config.variables.arm_version === '7') {
10-
common.skip('Too slow for armv7 bots');
9+
if (common.isPi) {
10+
common.skip('Too slow for Raspberry Pi devices');
1111
}
1212

1313
const assert = require('assert');

test/sequential/test-child-process-pass-fd.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const common = require('../common');
99
// This test is basically `test-cluster-net-send` but creating lots of workers
1010
// so the issue reproduces on OS X consistently.
1111

12-
if (process.config.variables.arm_version === '7') {
13-
common.skip('Too slow for armv7 bots');
12+
if (common.isPi) {
13+
common.skip('Too slow for Raspberry Pi devices');
1414
}
1515

1616
const assert = require('assert');

0 commit comments

Comments
 (0)