Skip to content

Commit

Permalink
test,report: relax CPU match requirements
Browse files Browse the repository at this point in the history
Some CPUs have variable speeds, and so exact matches between what
`os.cpus()` and the report feature yield cannot always be expected:

```
>const results = []
>setInterval(() => results.push(os.cpus().map(({ speed }) => speed)), 1)
[...]
>results
[
  [ 1198, 1150, 1195, 1149 ],
  [ 1198, 1150, 1195, 1149 ],
  [ 1198, 1150, 1195, 1149 ],
  [ 1198, 1150, 1195, 1149 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2401, 2420, 2429, 2413 ],
  [ 2596, 2401, 2699, 2555 ],
[...]
```

Refs: nodejs#28829

PR-URL: nodejs#28884
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax authored and Trott committed Jul 29, 2019
1 parent 92ca2c2 commit 98d8ed6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/common/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function _validateContent(report) {
assert.strictEqual(typeof cpu.idle, 'number');
assert.strictEqual(typeof cpu.irq, 'number');
assert(cpus.some((c) => {
return c.model === cpu.model && c.speed === cpu.speed;
return c.model === cpu.model;
}));
});
assert.strictEqual(header.host, os.hostname());
Expand Down

0 comments on commit 98d8ed6

Please sign in to comment.