# HG changeset patch # User mseledtsov # Date 1571944712 25200 # Node ID 5a9dba5a3eeb3c7e85874d05aa6d7e77569d3224 # Parent a2dfaae89445d24456ccf8abb32d772543509e61 8227317: [TESTBUG] jdk docker/TestDockerMemoryMetrics.java fails on systems w/o kernel memory accounting Summary: skipping the test case if kernel memory acct not supported Reviewed-by: sgehwolf, lmesnik diff -r a2dfaae89445 -r 5a9dba5a3eeb test/jdk/ProblemList.txt --- a/test/jdk/ProblemList.txt Thu Oct 24 11:25:53 2019 -0700 +++ b/test/jdk/ProblemList.txt Thu Oct 24 12:18:32 2019 -0700 @@ -890,6 +890,4 @@ # jdk_internal -jdk/internal/platform/docker/TestDockerMemoryMetrics.java 8227317 linux-x64 - ############################################################################ diff -r a2dfaae89445 -r 5a9dba5a3eeb test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java --- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java Thu Oct 24 11:25:53 2019 -0700 +++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java Thu Oct 24 12:18:32 2019 -0700 @@ -25,6 +25,7 @@ import jdk.test.lib.containers.docker.Common; import jdk.test.lib.containers.docker.DockerRunOptions; import jdk.test.lib.containers.docker.DockerTestUtils; +import jdk.test.lib.process.OutputAnalyzer; /* * @test @@ -119,7 +120,19 @@ .addJavaOpts("-cp", "/test-classes/") .addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED") .addClassOptions("kernelmem", value); - DockerTestUtils.dockerRunJava(opts).shouldHaveExitValue(0).shouldContain("TEST PASSED!!!"); + OutputAnalyzer oa = DockerTestUtils.dockerRunJava(opts); + + // Some container runtimes (e.g. runc, docker 18.09) + // have been built without kernel memory accounting. In + // that case, the runtime issues a message on stderr saying + // so. Skip the test in that case. + if (oa.getStderr().contains("kernel memory accounting disabled")) { + System.out.println("Kernel memory accounting disabled, " + + "skipping the test case"); + return; + } + + oa.shouldHaveExitValue(0).shouldContain("TEST PASSED!!!"); } private static void testOomKillFlag(String value, boolean oomKillFlag) throws Exception {