Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: only skip slow tests on Raspberry Pi devices #42645

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Copy link
Member Author

@richardlau richardlau Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: BCM2835 matches what /proc/cpuinfo returns on the Pi 2's and 3's in our CI.
e.g.

Pi 3
$ docker exec node-ci-stretch cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 76.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 76.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 76.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 76.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a22082
Serial          : 000000001acb5e3f
Model           : Raspberry Pi 3 Model B Rev 1.2
Pi 2:
 $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 1
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 2
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 3
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : BCM2835
Revision        : a21041
Serial          : 00000000e74d942b
Model           : Raspberry Pi 2 Model B Rev 1.1

I haven't matched against other Pi chipsets -- I don't know, for example, whether the Pi 4's are fast enough to run these slow tests (we don't have any in the Node.js CI).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also os.cpus() doesn't return the Hardware field:

$ node -p "os.cpus()"
[
  {
    model: 'ARMv7 Processor rev 4 (v7l)',
    speed: 1200,
    times: { user: 5251030, nice: 0, sys: 634800, idle: 56307240, irq: 0 }
  },
  {
    model: 'ARMv7 Processor rev 4 (v7l)',
    speed: 1200,
    times: { user: 5691040, nice: 0, sys: 1000630, idle: 56166190, irq: 0 }
  },
  {
    model: 'ARMv7 Processor rev 4 (v7l)',
    speed: 1200,
    times: { user: 5880350, nice: 10, sys: 953020, idle: 55968650, irq: 0 }
  },
  {
    model: 'ARMv7 Processor rev 4 (v7l)',
    speed: 1200,
    times: { user: 5741270, nice: 0, sys: 945350, idle: 56215820, irq: 0 }
  }
]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the problem with /sys? It's not available at all or that specific path doesn't exist or ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mscdex That specific path doesn't exist.

pi@test-requireio--williamkapke-debian10-arm64--pi3-3:~ $ docker exec node-ci-stretch ls -al /sys
total 4
dr-xr-xr-x  12 root root    0 Apr  7 01:22 .
drwxr-xr-x  20 root root 4096 Apr  7 01:21 ..
drwxr-xr-x   2 root root    0 Apr  8 01:22 block
drwxr-xr-x  26 root root    0 Apr  8 01:22 bus
drwxr-xr-x  54 root root    0 Apr  8 01:22 class
drwxr-xr-x   4 root root    0 Apr  8 01:22 dev
drwxr-xr-x  11 root root    0 Apr  8 01:16 devices
drwxrwxrwt   2 root root   40 Apr  7 01:22 firmware
drwxr-xr-x   7 root root    0 Apr  7 01:22 fs
drwxr-xr-x  12 root root    0 Apr  8 01:22 kernel
drwxr-xr-x 124 root root    0 Apr  8 01:22 module
drwxr-xr-x   2 root root    0 Apr  8 01:22 power
pi@test-requireio--williamkapke-debian10-arm64--pi3-3:~ $ docker exec node-ci-stretch ls -al /sys/firmware
total 0
drwxrwxrwt  2 root root 40 Apr  7 01:22 .
dr-xr-xr-x 12 root root  0 Apr  7 01:22 ..
pi@test-requireio--williamkapke-debian10-arm64--pi3-3:~ $

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW there should also be /proc/device-tree/model. Not sure if that's better or worse than parsing /proc/cpuinfo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/proc/device-tree appears to be a symlink inside the container pointing to a non-existent location:

pi@test-requireio--williamkapke-debian10-arm64--pi3-3:~ $ docker exec node-ci-stretch ls -al /proc/device-tree
lrwxrwxrwx 1 root root 29 Apr  8 01:37 /proc/device-tree -> /sys/firmware/devicetree/base
pi@test-requireio--williamkapke-debian10-arm64--pi3-3:~ $ docker exec node-ci-stretch ls -al /proc/device-tree/
ls: cannot access '/proc/device-tree/': No such file or directory
pi@test-requireio--williamkapke-debian10-arm64--pi3-3:~ $

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also moby/moby#43419.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't stop it running on a pi4, but as you said that doesn't matter as we don't have any:

Hardware	: BCM2711
Revision	: d03114
Serial		: 10000000302bfe33
Model		: Raspberry Pi 4 Model B Rev 1.4

Similarly the ODROID distributions give their own custom output e.g.

Hardware	: Hardkernel ODROID-XU4
Revision	: 0100
Serial		: 0000000000000000

(FYI I get timeouts in a couple of keepalive tests on that machine which is one of my own dev boxes, but no other timeouts based on the one run I've just done)

} 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
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