From 46b3d1d8cfd03e01d993be19d725cdbcafef7865 Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Tue, 18 Mar 2025 09:37:45 +0000 Subject: [PATCH] 8351382: New test containers/docker/TestMemoryWithSubgroups.java is failing Reviewed-by: sgehwolf, dholmes --- .../docker/TestMemoryWithSubgroups.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java index e7989874d7a..2245090ac55 100644 --- a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java +++ b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java @@ -21,6 +21,7 @@ * questions. */ +import jdk.test.lib.Container; import jdk.test.lib.containers.docker.Common; import jdk.test.lib.containers.docker.DockerTestUtils; import jdk.test.lib.containers.docker.DockerRunOptions; @@ -46,6 +47,19 @@ public class TestMemoryWithSubgroups { private static final String imageName = Common.imageName("subgroup"); + static String getEngineInfo(String format) throws Exception { + return DockerTestUtils.execute(Container.ENGINE_COMMAND, "info", "-f", format) + .getStdout(); + } + + static boolean isRootless() throws Exception { + // Docker and Podman have different INFO structures. + // The node path for Podman is .Host.Security.Rootless, that also holds for + // Podman emulating Docker CLI. The node path for Docker is .SecurityOptions. + return (getEngineInfo("{{.Host.Security.Rootless}}").contains("true") || + getEngineInfo("{{.SecurityOptions}}").contains("name=rootless")); + } + public static void main(String[] args) throws Exception { Metrics metrics = Metrics.systemMetrics(); if (metrics == null) { @@ -56,6 +70,9 @@ public class TestMemoryWithSubgroups { System.out.println("Unable to run docker tests."); return; } + if (isRootless()) { + throw new SkippedException("Test skipped in rootless mode"); + } Common.prepareWhiteBox(); DockerTestUtils.buildJdkContainerImage(imageName);