On Thu, 28 May 2026 06:28:53 GMT, Ashay Rane <[email protected]> wrote:

>> Previously, the test expected a precise match between the produced and
>> expected error messages, but such a check fails when the test fails for
>> more than the expected reason, like when WiX is not available on
>> Windows.   With this patch, specific test cases that require WiX are
>> skipped when WiX is unavailable.  To probe if WiX is available, we use
>> reflection to call `jdk.jpackage.internal.WixTool.createToolSet()` and
>> check whether the call resulted in an `InvocationTargetException`.  The
>> reason for using reflection as opposed to a static reference is that the
>> `WixTool` package exists only in the Windows builds.
>> 
>> Validated this patch on a Windows box that doesn't have WiX available.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Ashay Rane has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Skip test if WiX isn't available or the test spec doesn't care about WiX
>   
>   Instead of relaxing the error check, this patch selectively skips test
>   cases when the test case either doesn't care about WiX (like the
>   `--help` or `--version` test cases) or when WiX is necessary to run the
>   test case but WiX isn't available.  To probe if WiX is available, we use
>   reflection to call `jdk.jpackage.internal.WixTool.createToolSet()` and
>   check whether the call resulted in an `InvocationTargetException`.  The
>   reason for using reflection as opposed to a static reference is that the
>   `WixTool` package exists only in the Windows builds.

Sorry for the late response.

After a second thought, I concluded that we don't need to exclude any tests.

The failing unit tests don't test native bundling; they test how jpackage 
handles an invalid command line. i.e., jpackage should not perform bundling; it 
should bail out earlier with the expected error messages. Given that, we can 
mock up the native bundling functionality to make jpackage believe it is 
properly configured.

I've attached the patch with the corresponding fix. It should make tests pass 
on Windows hosts without WiX and on Alpine Linux, where DEB and RPM packaging 
are unavailable.

[JDK-8384087.patch](https://github.com/user-attachments/files/28408624/JDK-8384087.patch)

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

PR Comment: https://git.openjdk.org/jdk/pull/31282#issuecomment-4579602196

Reply via email to