7112404: 2 tests in java/lang/management/ManagementFactory fails with G1 because expect non-zero pools
authorjbachorik
Wed, 23 Oct 2013 15:03:49 +0200
changeset 21345 822b73ad4cc0
parent 21344 13091b742137
child 21346 793a4fec2332
7112404: 2 tests in java/lang/management/ManagementFactory fails with G1 because expect non-zero pools Reviewed-by: mchung, sjiang
jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java
jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Wed Oct 23 11:00:12 2013 +0100
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Wed Oct 23 15:03:49 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@
 import static java.lang.management.ManagementFactory.*;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import com.sun.management.GcInfo;
 
 public class ProxyTypeMapping {
@@ -162,23 +161,23 @@
     }
 
     private static void checkMemoryUsage() throws Exception {
-        // sanity check to have non-zero usage
+        // sanity check to have non-negative usage
         MemoryUsage u1 = memory.getHeapMemoryUsage();
         MemoryUsage u2 = memory.getNonHeapMemoryUsage();
         MemoryUsage u3 = heapPool.getUsage();
         MemoryUsage u4 = nonHeapPool.getUsage();
-        if (u1.getCommitted() <= 0 ||
-            u2.getCommitted() <= 0 ||
-            u3.getCommitted() <= 0 ||
-            u4.getCommitted() <= 0) {
+        if (u1.getCommitted() < 0 ||
+            u2.getCommitted() < 0 ||
+            u3.getCommitted() < 0 ||
+            u4.getCommitted() < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed usage");
+                " expected non-negative committed usage");
         }
         memory.gc();
         MemoryUsage u5 = heapPool.getCollectionUsage();
-        if (u5.getCommitted() <= 0) {
+        if (u5.getCommitted() < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed collected usage");
+                " expected non-negative committed collected usage");
         }
     }
 
--- a/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Wed Oct 23 11:00:12 2013 +0100
+++ b/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Wed Oct 23 15:03:49 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug     5024531
- * @summary Validata open types mapped for the MXBeans in the platform
+ * @summary Validate open types mapped for the MXBeans in the platform
  *          MBeanServer.
  * @author  Mandy Chung
  *
@@ -38,7 +38,6 @@
 import static java.lang.management.ManagementFactory.*;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import com.sun.management.GcInfo;
 
 public class ValidateOpenTypes {
@@ -178,23 +177,23 @@
     }
 
     private static void checkMemoryUsage() throws Exception {
-        // sanity check to have non-zero usage
+        // sanity check to have non-negative usage
         Object u1 = server.getAttribute(memory, "HeapMemoryUsage");
         Object u2 = server.getAttribute(memory, "NonHeapMemoryUsage");
         Object u3 = server.getAttribute(heapPool, "Usage");
         Object u4 = server.getAttribute(nonHeapPool, "Usage");
-        if (getCommitted(u1) <= 0 ||
-            getCommitted(u2) <= 0 ||
-            getCommitted(u3) <= 0 ||
-            getCommitted(u4) <= 0) {
+        if (getCommitted(u1) < 0 ||
+            getCommitted(u2) < 0 ||
+            getCommitted(u3) < 0 ||
+            getCommitted(u4) < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed usage");
+                " expected non-negative committed usage");
         }
         server.invoke(memory, "gc", new Object[0], new String[0]);
         Object u5 = server.getAttribute(heapPool, "CollectionUsage");
-        if (getCommitted(u5) <= 0) {
+        if (getCommitted(u5) < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed collected usage");
+                " expected non-negative committed collected usage");
         }
     }