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

David Holmes dholmes at openjdk.java.net
Mon Jun 21 02:20:27 UTC 2021


On Fri, 18 Jun 2021 10:55:08 GMT, Igor Ignatyev <iignatyev 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

Sorry Igor I don't think 2 of these changes are needed/warranted.

David

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.

test/hotspot/jtreg/runtime/memory/ReserveMemory.java line 62:

> 60: 
> 61:     OutputAnalyzer output = new OutputAnalyzer(pb.start());
> 62:     output.shouldNotHaveExitValue(0);

Ditto - redundant.

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

Changes requested by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list