RFR: 8298939: Refactor open/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.sh to jtreg java test [v3]

Matthew Donovan duke at openjdk.org
Mon Feb 27 14:04:43 UTC 2023


On Tue, 21 Feb 2023 18:59:35 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> I don't think all of those code paths ever executed. If `System.exit()` is called, regardless of the exit code, `make` treats it as an error:
>> 
>> `TEST RESULT: Failed. Unexpected exit from test [exit code: 0]`
>> 
>> I added a try/catch in `main` so that if an exception is thrown during the test, `System.exit` will be called.
>
> My bad, I was confused about the execution environments. In the old test, jtreg invoked the shell script, which in turn invoked the Java test as a standalone Java program. In that environment it's paramount that every code path call System.exit() in order to avoid stale JVMs building up.
> 
> The new test is invoked directly by jtreg, which disallows calling System.exit(). Instead, every code path needs to result in the main() method completing somehow, either via a normal return or by throwing an exception directly or letting one propagate from some called method. So, you need to pull out the try/catch and any calls to System.exit(). Sorry about that.
> 
> If we're going to stick with a scheme where we're running separate JVM per test, there's no need to unexport any RMI service. When main() returns or throws an exception, jtreg will detect this and terminate the JVM because of /othervm, and any exported RMI services will be destroyed at that time. Thus, the finally-block in `testRmiCommunication` can simply be removed.

I removed the finally block.

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

PR: https://git.openjdk.org/jdk/pull/11910


More information about the core-libs-dev mailing list