< prev index next >
test/runtime/os/AvailableProcessors.java
Print this page
@@ -25,11 +25,11 @@
import jdk.test.lib.OutputAnalyzer;
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
* @build jdk.test.lib.*
* @run driver AvailableProcessors
@@ -91,11 +91,13 @@
}
}
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 > expected)
throw new Error("Expected " + expected + " processors, but found "
+ available);
else
System.out.println(SUCCESS_STRING + available);
}
< prev index next >