# HG changeset patch # User jbachorik # Date 1423726427 -3600 # Node ID 433de2a382717717c0c2a5092783274bf5edd420 # Parent f97d41a21983f9d8bcfecd5f358a507f718febfe 8069286: Unexpected count of notification in LowMemoryTest Reviewed-by: mchung diff -r f97d41a21983 -r 433de2a38271 jdk/test/ProblemList.txt --- a/jdk/test/ProblemList.txt Tue Feb 10 14:10:32 2015 +0100 +++ b/jdk/test/ProblemList.txt Thu Feb 12 08:33:47 2015 +0100 @@ -141,9 +141,6 @@ # 8058492 java/lang/management/ThreadMXBean/FindDeadlocks.java generic-all -# 8069286 -java/lang/management/MemoryMXBean/LowMemoryTest.java generic-all - ############################################################################ # jdk_jmx diff -r f97d41a21983 -r 433de2a38271 jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java --- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java Tue Feb 10 14:10:32 2015 +0100 +++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java Thu Feb 12 08:33:47 2015 +0100 @@ -32,8 +32,7 @@ * * @library /lib/testlibrary/ * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil - * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null" - * @run main/timeout=600 LowMemoryTest + * @run main/timeout=600 LowMemoryTest * @requires vm.opt.ExplicitGCInvokesConcurrent != "true" * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true" * @requires vm.opt.DisableExplicitGC != "true" @@ -116,14 +115,13 @@ triggers++; } public void checkResult() throws Exception { - if ((!isRelaxed && triggers != NUM_TRIGGERS) || - (isRelaxed && triggers < NUM_TRIGGERS)) { + if (!checkValue(triggers, NUM_TRIGGERS)) { throw new RuntimeException("Unexpected number of triggers = " + triggers + " but expected to be " + NUM_TRIGGERS); } for (int i = 0; i < triggers; i++) { - if (count[i] != i+1) { + if (!checkValue(count[i], i + 1)) { throw new RuntimeException("Unexpected count of" + " notification #" + i + " count = " + count[i] + @@ -136,6 +134,18 @@ } } } + + private boolean checkValue(int value, int target) { + return checkValue((long)value, target); + } + + private boolean checkValue(long value, int target) { + if (!isRelaxed) { + return value == target; + } else { + return value >= target; + } + } } private static long newThreshold;