From be21ae5d78e63673cfaaa79be70d47f7331f5298 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Wed, 24 Dec 2025 11:29:14 +0800 Subject: [PATCH] 8374322: TestMemoryWithSubgroups.java fails Permission denied --- .../docker/TestMemoryWithSubgroups.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java index 35b7bf993f7..d2d90c4cbb0 100644 --- a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java +++ b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java @@ -26,6 +26,7 @@ import jdk.test.lib.containers.docker.Common; 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; @@ -101,8 +102,11 @@ public class TestMemoryWithSubgroups { "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) @@ -123,7 +127,10 @@ public class TestMemoryWithSubgroups { "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); } }