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: #28829

PR-URL: #28884
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
addaleax authored and targos committed Aug 2, 2019
1 parent a7ef102 commit 0b6a84a
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 0b6a84a

Please sign in to comment.