|
29 | 29 | * @requires !vm.asan |
30 | 30 | * @library /test/lib |
31 | 31 | * @modules java.base/jdk.internal.misc |
| 32 | + * java.base/jdk.internal.platform |
32 | 33 | * java.management |
33 | 34 | * jdk.jartool/sun.tools.jar |
34 | 35 | * @build CheckContainerized jdk.test.whitebox.WhiteBox PrintContainerInfo |
35 | 36 | * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox |
36 | 37 | * @run driver TestMisc |
37 | 38 | */ |
| 39 | +import jdk.internal.platform.Metrics; |
38 | 40 | import jdk.test.lib.containers.docker.Common; |
39 | 41 | import jdk.test.lib.containers.docker.DockerTestUtils; |
40 | 42 | import jdk.test.lib.containers.docker.DockerRunOptions; |
41 | 43 | import jdk.test.lib.process.OutputAnalyzer; |
42 | 44 | import jdk.test.lib.process.ProcessTools; |
| 45 | +import jtreg.SkippedException; |
43 | 46 |
|
44 | 47 |
|
45 | 48 | public class TestMisc { |
| 49 | + private static final Metrics metrics = Metrics.systemMetrics(); |
46 | 50 | private static final String imageName = Common.imageName("misc"); |
47 | 51 |
|
48 | 52 | public static void main(String[] args) throws Exception { |
@@ -98,6 +102,14 @@ private static void testPrintContainerInfo() throws Exception { |
98 | 102 | // Test the mapping function on cgroups v2. Should also pass on cgroups v1 as it's |
99 | 103 | // a direct mapping there. |
100 | 104 | private static void testPrintContainerInfoCPUShares() throws Exception { |
| 105 | + // Test won't work on cgv1 rootless podman since resource limits don't |
| 106 | + // work there. |
| 107 | + if ("cgroupv1".equals(metrics.getProvider()) && |
| 108 | + DockerTestUtils.isPodman() && |
| 109 | + DockerTestUtils.isRootless()) { |
| 110 | + throw new SkippedException("Resource limits required for testPrintContainerInfoCPUShares(). " + |
| 111 | + "This is cgv1 with podman in rootless mode. Test skipped."); |
| 112 | + } |
101 | 113 | // Anything less than 1024 should return the back-mapped cpu-shares value without |
102 | 114 | // rounding to next multiple of 1024 (on cg v2). Only ensure that we get |
103 | 115 | // 'cpu_shares: <back-mapped-value>' over 'cpu_shares: no shares'. |
|
0 commit comments