< prev index next >

test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java

Print this page
@  rev 58200 : 8240189: [TESTBUG] Some cgroup tests are failing after JDK-8231111
|  Reviewed-by: mbaesken
~

@@ -21,14 +21,17 @@
  * questions.
  */
 
 import java.util.Arrays;
 
-import jdk.internal.platform.Metrics;
 import jdk.internal.platform.CgroupV1Metrics;
+import jdk.internal.platform.Metrics;
 
 public class MetricsMemoryTester {
+
+    public static final long UNLIMITED = -1;
+
     public static void main(String[] args) {
         System.out.println(Arrays.toString(args));
         switch (args[0]) {
             case "memory":
                 testMemoryLimit(args[1]);

@@ -113,17 +116,17 @@
         if (m instanceof CgroupV1Metrics) {
             CgroupV1Metrics mCgroupV1 = (CgroupV1Metrics)m;
             System.out.println("TEST PASSED!!!");
             long limit = getMemoryValue(value);
             long kmemlimit = mCgroupV1.getKernelMemoryLimit();
-            if (kmemlimit != 0 && limit != kmemlimit) {
+            if (kmemlimit != UNLIMITED && limit != kmemlimit) {
                 throw new RuntimeException("Kernel Memory limit not equal, expected : ["
                         + limit + "]" + ", got : ["
                         + kmemlimit + "]");
             }
         } else {
-            throw new RuntimeException("oomKillFlag test not supported for cgroups v2");
+            throw new RuntimeException("kernel memory limit test not supported for cgroups v2");
         }
     }
 
     private static void testMemoryAndSwapLimit(String memory, String memAndSwap) {
         long expectedMem = getMemoryValue(memory);
< prev index next >