On 10/8/15 1:37 AM, Jaroslav Bachorik wrote:
Please, review the following test change

Issue : https://bugs.openjdk.java.net/browse/JDK-8135188
Webrev: http://cr.openjdk.java.net/~jbachorik/8135188/webrev.00

test/serviceability/dcmd/gc/RunFinalizationTest.java
    L54:         out.stderrShouldBeEmpty();
        This check is fragile. There are plenty of options that can
        cause output on stderr and that would cause a false failure
        in this test.

        A check for a clear message that the test passed would be
        good (IMHO).

test/serviceability/dcmd/gc/FinalizationRunner.java
    L78:         if (!wasFinalized) {
    L79:             fail("Test failure: Object was not finalized");
    L80:         }

         A clear message about the object being finalized would be
         good here. I'm not a fan of tests that are silent when
         they pass.

Dan



The problem is described in detail in the issue. This patch follows the recommendation by Dan Daugherty and runs the part where finalization is being requested in a shutdown handler as a separate process. The test then checks the result of this separate process to see whether any errors were reported. In order to simplify the logic of the shutdown handler the failures are reported by simply printing messages into stderr as opposed to throwing 'new Error()'.

The modified test is still passing on all supported platforms.

Thanks,

-JB-

Reply via email to