Skip to content

Commit 8a19abc

Browse files
richardlaujuanarbol
authored andcommitted
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: #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>
1 parent c6d8503 commit 8a19abc

21 files changed

+55
-48
lines changed

test/common/index.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ 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+
})();
123134

124135
const isDumbTerminal = process.env.TERM === 'dumb';
125136

@@ -246,15 +257,10 @@ function platformTimeout(ms) {
246257
if (isAIX)
247258
return multipliers.two * ms; // Default localhost speed is slower on AIX
248259

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
260+
if (isPi)
261+
return multipliers.two * ms; // Raspberry Pi devices
256262

257-
return ms; // ARMv8+
263+
return ms;
258264
}
259265

260266
let knownGlobals = [
@@ -790,6 +796,7 @@ const common = {
790796
isMainThread,
791797
isOpenBSD,
792798
isOSX,
799+
isPi,
793800
isSunOS,
794801
isWindows,
795802
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-repl-empty-maybelocal-crash.js

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

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

88
// The process should not crash when the REPL receives the string, 'ss'.

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)