8227317: [TESTBUG] jdk docker/TestDockerMemoryMetrics.java fails on systems w/o kernel memory accounting

Skipping the test case if kernel memory acct not supported

Reviewed-by: sgehwolf, lmesnik
This commit is contained in:
Mikhailo Seledtsov 2019-10-24 12:18:32 -07:00
parent 0501511825
commit cd4d0bc498
2 changed files with 14 additions and 3 deletions

View File

@ -890,6 +890,4 @@ jdk/jfr/event/oldobject/TestLargeRootSet.java 8205651 gener
# jdk_internal
jdk/internal/platform/docker/TestDockerMemoryMetrics.java 8227317 linux-x64
############################################################################

View File

@ -25,6 +25,7 @@ import jdk.test.lib.Utils;
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 @@ public class TestDockerMemoryMetrics {
.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 {