RFR: 8346434: Add test for non-automatic service binding
Alexey Semenyuk
asemenyuk at openjdk.org
Wed Feb 5 19:51:04 UTC 2025
On Wed, 5 Feb 2025 03:25:46 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:
>> Added a test case to JLinkOptionsTest to test that jpackage doesn't bind services in app's runtime by default.
>>
>> The test builds two app images for the same app. One with the default jlink options and another with `--bind-services` jlink option. The test compares module lists from both runtimes. The expected result is that the runtime built with `--bind-services` jlink option has additional modules.
>>
>> The PR must be integrated after https://github.com/openjdk/jdk/pull/22644. Otherwise, the newly added test will fail.
>
> test/jdk/tools/jpackage/share/JLinkOptionsTest.java line 175:
>
>> 173: .setExecutable(cmd.appLauncherPath().toAbsolutePath())
>> 174: .addArguments("--print-modules")
>> 175: .executeAndRepeatUntilExitCode(0, attempts,
>
> Is there any reason why we need to repeat execution?
Yes, launchers in tests are executed multiple times because they may sporadically crash due to an unidentified issue with JVM termination.
Usually, launchers are not explicitly executed in the tests. They are executed as a part of `JPackageCommand.executeAndAssertHelloAppImageCreated()` call, which attempts to run them multiple times if necessary.
In this test, launcher is explicitly executed and the setup to run it multiple times if needed is explicit.
This setup copies a setup to run launchers from [HelloApp.AppOutputVerifier.execute()](https://github.com/openjdk/jdk/blob/379c3f99665829c5d8c373d1fb324dc7ef4d84cf/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java#L441)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23047#discussion_r1943572376
More information about the core-libs-dev
mailing list