8148766: Test AvailableProcessors.java got wrong number of processors

Reviewed-by: dsamersoff, tschatzl, mseledtsov
This commit is contained in:
David Holmes 2016-02-02 05:38:33 -05:00
parent de76c23ff5
commit 69088591f9

View File

@ -27,7 +27,7 @@ import java.util.ArrayList;
/*
* @test
* @bug 6515172
* @bug 6515172 8148766
* @summary Check that availableProcessors reports the correct value when running in a cpuset on linux
* @requires os.family == "linux"
* @library /testlibrary
@ -93,7 +93,9 @@ public class AvailableProcessors {
static void checkProcessors(int expected) {
int available = Runtime.getRuntime().availableProcessors();
if (available != expected)
// available can dynamically drop below expected due to aggressive power management
// but we should never have more than expected, else taskset is broken
if (available <= 0 || available > expected)
throw new Error("Expected " + expected + " processors, but found "
+ available);
else