[crac] RFR: 8364449: [CRaC] Launch new main outside of the core C/R body [v2]

Timofei Pushkin tpushkin at openjdk.org
Thu Aug 7 08:03:32 UTC 2025


On Thu, 7 Aug 2025 06:52:16 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add missing space
>
> test/jdk/jdk/crac/newArgs/FailedCheckpointRestoreTest.java line 104:
> 
>> 102:             System.out.println(RESTORE_MSG);
>> 103:         } catch (CheckpointException ex) {
>> 104:             if (variant != Variant.CHECKPOINT_EXCEPTION) {
> 
> Could you rather check this using `jdk.test.lib.Asserts.*`?

With asserts I'd need to format the the caught exception by myself to print it. Just using `ex.toString()` will not include all the info `throw` includes.

The current way:

Exception in thread "main" java.lang.IllegalStateException: Unexpected suppression message
        at FailedCheckpointRestoreTest.exec(FailedCheckpointRestoreTest.java:126)
        at jdk.test.lib.crac.CracTest.run(CracTest.java:165)
        at jdk.test.lib.crac.CracTest.main(CracTest.java:90)
Caused by: jdk.crac.RestoreException
        Suppressed: java.lang.RuntimeException: restoreFail
                at FailedCheckpointRestoreTest$1.afterRestore(FailedCheckpointRestoreTest.java:99)
                at jdk.crac/jdk.crac.ResourceWrapper.afterRestore(ResourceWrapper.java:78)
                at java.base/jdk.internal.crac.mirror.impl.AbstractContext.invokeAfterRestore(AbstractContext.java:49)
                at java.base/jdk.internal.crac.mirror.impl.AbstractContext.afterRestore(AbstractContext.java:74)
                at jdk.crac/jdk.crac.ContextWrapper.afterRestore(ContextWrapper.java:61)
                at jdk.crac/jdk.crac.ResourceWrapper.afterRestore(ResourceWrapper.java:78)
                at java.base/jdk.internal.crac.mirror.impl.AbstractContext.invokeAfterRestore(AbstractContext.java:49)
                at java.base/jdk.internal.crac.mirror.impl.AbstractContext.afterRestore(AbstractContext.java:74)
                at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:205)
                at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:287)
                at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:263)
                at jdk.crac/jdk.crac.Core.checkpointRestore(Core.java:73)
                at FailedCheckpointRestoreTest.exec(FailedCheckpointRestoreTest.java:106)
                at jdk.test.lib.crac.CracTest.run(CracTest.java:165)
                at jdk.test.lib.crac.CracTest.main(CracTest.java:90)


Using `Asserts.assertEquals(restoreFail, ex.getSuppressed()[0].getMessage(), "Unexpected suppression message: " + ex)`:

Exception in thread "main" java.lang.RuntimeException: Unexpected suppression message: jdk.crac.RestoreException expected: Failing on restore! but was: restoreFail
        at jdk.test.lib.Asserts.fail(Asserts.java:715)
        at jdk.test.lib.Asserts.assertEquals(Asserts.java:208)
        at FailedCheckpointRestoreTest.exec(FailedCheckpointRestoreTest.java:127)
        at jdk.test.lib.crac.CracTest.run(CracTest.java:165)
        at jdk.test.lib.crac.CracTest.main(CracTest.java:90)


Sure it can be formatted better but just using `throw` seems easier.

-------------

PR Review Comment: https://git.openjdk.org/crac/pull/253#discussion_r2259470679


More information about the crac-dev mailing list