Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jdk.test.lib.containers.docker.DockerTestUtils;
import jdk.test.lib.containers.docker.ContainerRuntimeVersionTestUtils;
import jdk.test.lib.containers.docker.DockerRunOptions;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.internal.platform.Metrics;

import java.util.ArrayList;
Expand Down Expand Up @@ -101,8 +102,11 @@ private static void testMemoryLimitSubgroupV1(String containerMemorySize, String
"echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
"/jdk/bin/java -Xlog:os+container=trace -version");

Common.run(opts)
.shouldMatch("Lowest limit was:.*" + expectedValue);
OutputAnalyzer oa = Common.run(opts);
if (oa.stdoutContains("cgroup.procs: Permission denied")) {
throw new SkippedException("Skip test since do not have privilege permission inside docker");
}
oa.shouldMatch("Lowest limit was:.*" + expectedValue);
}

private static void testMemoryLimitSubgroupV2(String containerMemorySize, String valueToSet, String expectedValue, boolean privateNamespace)
Expand All @@ -123,7 +127,10 @@ private static void testMemoryLimitSubgroupV2(String containerMemorySize, String
"echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.max ; " +
"/jdk/bin/java -Xlog:os+container=trace -version");

Common.run(opts)
.shouldMatch("Lowest limit was:.*" + expectedValue);
OutputAnalyzer oa = Common.run(opts);
if (oa.stdoutContains("cgroup.procs: Permission denied")) {
throw new SkippedException("Skip test since do not have privilege permission inside docker");
}
oa.shouldMatch("Lowest limit was:.*" + expectedValue);
}
}