RFR: 8351372: Improve negative tests coverage of jpackage

Alexander Matveev almatvee at openjdk.org
Sat Mar 8 04:31:04 UTC 2025


On Thu, 6 Mar 2025 23:30:09 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

> Changes to tests:
>  - Added more test cases to ErrorTest.
>  - Added functionality to jpackage test lib to facilitate new ErrorTest test cases.
>  - Make all other negative tests use the `CannedFormattedString` class to validate error messages in jpackage output strictly.
>  - Removed redundant negative tests/test cases duplicating ErrorTest.
>  - Give unique descriptions to macos signing tests.
>  
> Changes to jpackage:
>  - Main.java: Catch `java.nio.file.NoSuchFileException` as `jdk.internal.opt.CommandLine.parse()` throws this exception instead of  `java.io.FileNotFoundException` to indicate missing command file. The issue was uncovered with the new ErrorTest test case for `ERR_CannotParseOptions` error ID.
>  - DeployParams.java: replace `ERR_MissingArgument` with `error.no-input-parameter` as the error is not missing argument of `--input` parameter, but missing `--input` parameter itself. The issue was uncovered with the new ErrorTest test cases for `ERR_MissingArgument` and ``error.no-input-parameter` error IDs.
>  - LauncherData.java: remove dead code as missing `--input` parameter is handled earlier in DeployParams.
>  - DottedVersion.java: fix exception messages based on the new test cases in ErrorTest.
>  - TokenRepalce.java/TokenRepalceTest.java: picked from https://github.com/openjdk/jdk/pull/23923 PR. It is needed for ErrorTest as well.

Looks good with minor comments.

test/jdk/tools/jpackage/macosx/base/SigningBase.java line 37:

> 35:     enum CertIndex {
> 36:         ASCII_INDEX(0),
> 37:         UNICODE_INDEX(0),

This one should be 1. Looks like we had a bug.

test/jdk/tools/jpackage/share/ErrorTest.java line 333:

> 331:             testSpec().addArgs("--type", "invalid-type")
> 332:                     .error("ERR_InvalidInstallerType", "invalid-type"),
> 333:             // no --input for non-mular app

`non-mular` -> `non-modular`

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

PR Review: https://git.openjdk.org/jdk/pull/23936#pullrequestreview-2668889041
PR Review Comment: https://git.openjdk.org/jdk/pull/23936#discussion_r1985970911
PR Review Comment: https://git.openjdk.org/jdk/pull/23936#discussion_r1985973850


More information about the core-libs-dev mailing list