Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8264524: jdk/internal/platform/docker/TestDockerMemoryMetrics.java fails due to swapping not working #3286

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -91,10 +91,6 @@ private static void testMemoryFailCount() {
break;
}
}

// We are not killed by the OOM killer.
System.out.println("Not OOM killed");

if (!atLeastOneAllocationWorked) {
System.out.println("Allocation failed immediately. Ignoring test!");
return;
@@ -102,6 +102,21 @@ private static void testMemoryLimit(String value) throws Exception {

private static void testMemoryFailCount(String value) throws Exception {
Common.logNewTestCase("testMemoryFailCount" + value);

// Check whether swapping really works for this test

This comment has been minimized.

@jerboaa

jerboaa Apr 6, 2021
Contributor

Please explain what "swapping not working" actually means in this comment. One version of it is already handled via JDK-8250984 so this is sort-of ambiguous. Suggestion: "On some systems there is no swap space enabled. On those systems running java -version??? with a memory limit fails due to swap space size being 0". Or something like that.

This comment has been minimized.

@DamonFool

DamonFool Apr 6, 2021
Author Member

Please explain what "swapping not working" actually means in this comment.

Updated.
Thanks.

DockerRunOptions preOpts =
new DockerRunOptions(imageName, "/jdk/bin/java", "-version");
preOpts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/")
.addDockerOpts("--memory=" + value)
.addJavaOpts("-Xms" + value)
.addJavaOpts("-Xmx" + value);
OutputAnalyzer oa = DockerTestUtils.dockerRunJava(preOpts);
String output = oa.getOutput();
if (!output.contains("version")) {
System.out.println("Swapping doesn't work for this test.");
return;
}

DockerRunOptions opts =
new DockerRunOptions(imageName, "/jdk/bin/java", "MetricsMemoryTester");
opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/")
@@ -110,14 +125,13 @@ private static void testMemoryFailCount(String value) throws Exception {
.addJavaOpts("-cp", "/test-classes/")
.addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED")
.addClassOptions("failcount");

OutputAnalyzer oa = DockerTestUtils.dockerRunJava(opts);
String output = oa.getOutput();
if (output.contains("Not OOM killed")) {
if (!output.contains("Ignoring test")) {
oa.shouldHaveExitValue(0).shouldContain("TEST PASSED!!!");
}
oa = DockerTestUtils.dockerRunJava(opts);
output = oa.getOutput();
if (output.contains("Ignoring test")) {
System.out.println("Ignored by the tester");
return;
}
oa.shouldHaveExitValue(0).shouldContain("TEST PASSED!!!");
}

private static void testMemoryAndSwapLimit(String memory, String memandswap) throws Exception {
ProTip! Use n and p to navigate between commits in a pull request.