[jdk17] RFR: 8268612: a few runtime/memory tests don't check exit code

David Holmes dholmes at openjdk.java.net
Mon Jun 21 04:22:30 UTC 2021


On Mon, 21 Jun 2021 02:13:54 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Hi all,
>> 
>> could you please review this small patch that adds checks of exit code to a few `runtime/memory` tests?
>> from JBS:
>>> `ReserveMemory.java`, `ReadFromNoaccessArea.java` and `TestLargePagesFlags.java` tests spawn new JVMs but don't check their exit code which might lead to both type-I and type-II errors
>> 
>> in `ReadFromNoaccessArea.java`, the patch removes throwing of an exception in `DummyClassWithMainTryingToReadFromNoaccessArea` (child process), so we will get 0 as an exit code if/when we don't crash.
>> 
>> testing: `runtime/memory` tests on `{linux,windows,macosx}-x64`
>> 
>> Thanks,
>> -- Igor
>
> test/hotspot/jtreg/runtime/memory/ReadFromNoaccessArea.java line 65:
> 
>> 63:       throw new SkippedException("There is no protected page in ReservedHeapSpace in these circumstance");
>> 64:     }
>> 65:     output.shouldNotHaveExitValue(0);
> 
> This is redundant. You will never have a zero exit value if you match the crash messages or else throw the exception. Seeing the crash message implies the return code is not zero so checking is a waste of time IMO not a more rigorous check. If the test did not crash then we won't match the expected output and we will still fail.

Sorry, please ignore my previous comment. If we inadvertently caused the call to exit with a zero return in case of a crash, this change would detect it.

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

PR: https://git.openjdk.java.net/jdk17/pull/97


More information about the hotspot-runtime-dev mailing list