RFR: 8350818: Improve OperatingSystemMXBean cpu load tests to don't accept -1.0 by default

Kevin Walls kevinw at openjdk.org
Fri Feb 28 09:52:01 UTC 2025


On Fri, 28 Feb 2025 00:05:23 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

> The cpuLoad tests were updated to fail if -1.0 returns to catch bugs like https://bugs.openjdk.org/browse/JDK-8350820
> 
> The -1.0 means that JDK can't obtain cpu load. It shouldn't be returned.
> If this functionality doesn't work on certain configurations then they should be excluded.
> 
> The fix should be pushed after https://bugs.openjdk.org/browse/JDK-8350820
> I filed separate PR to backport fix easier.
> Also, I haven't changed indentation and didn't change getSystemCpuLoad to getCpuLoad. They return same. 
> Might be it would be better. just to rename the whole test later.

Looks good, yes ignoring the -1 seems like a historical issue, maybe we had platforms or builds where -1 was expected.  Yes we can exclude the test if we find such configs.

-------------

Marked as reviewed by kevinw (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23833#pullrequestreview-2650269373


More information about the serviceability-dev mailing list