< prev index next >

test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java

Print this page
@  rev 56863 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
|  Reviewed-by: bobv
~

*** 67,79 **** --- 67,81 ---- testMemoryFailCount("64m"); testMemorySoftLimit("500m","200m"); } finally { + if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { DockerTestUtils.removeDockerImage(imageName); } } + } private static void testMemoryLimit(String value) throws Exception { Common.logNewTestCase("testMemoryLimit, value = " + value); DockerRunOptions opts = new DockerRunOptions(imageName, "/jdk/bin/java", "MetricsMemoryTester");
*** 129,138 **** --- 131,145 ---- if (oa.getStderr().contains("kernel memory accounting disabled")) { System.out.println("Kernel memory accounting disabled, " + "skipping the test case"); return; } + if (oa.getStderr().contains("cannot set kernel memory with cgroupv2")) { + System.out.println("Kernel memory settings not possible with cgroupv2, " + + "skipping the test case"); + return; + } oa.shouldHaveExitValue(0).shouldContain("TEST PASSED!!!"); } private static void testOomKillFlag(String value, boolean oomKillFlag) throws Exception {
*** 145,155 **** opts.addDockerOpts("--oom-kill-disable"); } opts.addJavaOpts("-cp", "/test-classes/") .addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED") .addClassOptions("memory", value, oomKillFlag + ""); ! DockerTestUtils.dockerRunJava(opts).shouldHaveExitValue(0).shouldContain("TEST PASSED!!!"); } private static void testMemorySoftLimit(String mem, String softLimit) throws Exception { Common.logNewTestCase("testMemorySoftLimit, memory = " + mem + ", soft limit = " + softLimit); DockerRunOptions opts = --- 152,169 ---- opts.addDockerOpts("--oom-kill-disable"); } opts.addJavaOpts("-cp", "/test-classes/") .addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED") .addClassOptions("memory", value, oomKillFlag + ""); ! OutputAnalyzer oa = DockerTestUtils.dockerRunJava(opts); ! if (oa.getStderr().contains("cannot disable OOM killer with cgroupv2")) { ! System.out.println("Disabling OOM killer not possible with cgroupv2, " + ! "skipping the test case"); ! return; ! } ! ! oa.shouldHaveExitValue(0).shouldContain("TEST PASSED!!!"); } private static void testMemorySoftLimit(String mem, String softLimit) throws Exception { Common.logNewTestCase("testMemorySoftLimit, memory = " + mem + ", soft limit = " + softLimit); DockerRunOptions opts =
< prev index next >