--- old/test/hotspot/jtreg/runtime/containers/docker/TestCPUAwareness.java 2017-11-28 16:34:17.024924210 -0800 +++ new/test/hotspot/jtreg/runtime/containers/docker/TestCPUAwareness.java 2017-11-28 16:34:16.888924214 -0800 @@ -52,12 +52,19 @@ try { // cpuset, period, shares, expected Active Processor Count testAPCCombo("0", 200*1000, 100*1000, 4*1024, 1); - testAPCCombo("0,1", 200*1000, 100*1000, 4*1024, 2); - testAPCCombo("0,1", 200*1000, 100*1000, 1*1024, 2); + if (availableCPUs >= 2) { + testAPCCombo("0,1", 200*1000, 100*1000, 4*1024, 2); + testAPCCombo("0,1", 200*1000, 100*1000, 1*1024, 2); + } + // cpu shares testCpuShares(256, 1); - testCpuShares(2048, 2); - testCpuShares(4096, 4); + if (availableCPUs >= 2) { + testCpuShares(2048, 2); + } + if (availableCPUs >= 4) { + testCpuShares(4096, 4); + } // leave one CPU for system and tools, otherwise this test may be unstable int maxNrOfAvailableCpus = availableCPUs - 1; @@ -70,9 +77,12 @@ testActiveProcessorCount(1, 1); testActiveProcessorCount(2, 2); + // cpu quota and period testCpuQuotaAndPeriod(50*1000, 100*1000); testCpuQuotaAndPeriod(100*1000, 100*1000); - testCpuQuotaAndPeriod(150*1000, 100*1000); + if (availableCPUs >= 2) { + testCpuQuotaAndPeriod(150*1000, 100*1000); + } } finally { DockerTestUtils.removeDockerImage(imageName);