Please review this small fix to correct a test failure when the Linux system kernel is not configured with the CONFIG_MEMCG_KMEM option.
The Container Metric tests are dependent on docker which allow us to assume a certain minimum Linux kernel configuration level. However, the kernel memory resource limiting feature is not a hard requirement for docker. This test will need to be updated to allow for running on kernels without this option. A 0 return from the getKernelMemoryLimit is defined to indicate that this API is not available. BUG: https://bugs.openjdk.java.net/browse/JDK-8205928 PROPOSED FIX: diff --git a/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java b/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java --- a/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java +++ b/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java @@ -95,10 +95,11 @@ private static void testKernelMemoryLimit(String value) { long limit = getMemoryValue(value); - if (limit != Metrics.systemMetrics().getKernelMemoryLimit()) { + long kmemlimit = Metrics.systemMetrics().getKernelMemoryLimit(); + if (kmemlimit != 0 && limit != kmemlimit) { throw new RuntimeException("Kernel Memory limit not equal, expected : [" + limit + "]" + ", got : [" - + Metrics.systemMetrics().getKernelMemoryLimit() + "]"); + + kmemlimit + "]"); } System.out.println("TEST PASSED!!!"); }