Java gc tests failure fix

Sometimes the GC just won't run the finalizers, so we output a warning
instead of throwing an error, so now the test-suite will pass but with a
warning if the number of objects is not as expected.

Was notably failing on RHEL6 using OpenSUSE build testing with openjdk-1.6
This commit is contained in:
William S Fulton 2014-10-13 20:20:33 +01:00
commit 8441e3eab4
3 changed files with 4 additions and 4 deletions

View file

@ -53,7 +53,7 @@ public class java_director_runme {
};
int actualCount = Quux.instances();
if (actualCount != expectedCount)
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
System.err.println("GC failed to run (java_director). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
/* Test Quux1's director disconnect method rename */

View file

@ -59,7 +59,7 @@ public class li_boost_shared_ptr_runme {
}
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
System.err.println("GC failed to run (li_boost_shared_ptr). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
int wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count();

View file

@ -43,7 +43,7 @@ public class li_std_auto_ptr_runme {
}
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
System.err.println("GC failed to run (li_std_auto_ptr 1). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
if (!k2.getLabel().equals("second"))
@ -62,7 +62,7 @@ public class li_std_auto_ptr_runme {
};
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
System.err.println("GC failed to run (li_std_auto_ptr 2). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
}
}