RFR: 8351372: Improve negative tests coverage of jpackage
Alexey Semenyuk
asemenyuk at openjdk.org
Fri Mar 7 19:55:10 UTC 2025
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.
-------------
Commit messages:
- Update copyright year
- Give unique descriptions to signing tests
- Ignore default runtime if jpackage command line has `--jlink-options` option.
- Ran ./bin/blessed-modifier-order.sh
- Update copyright year
- DeployParams: replace {"ERR_MissingArgument", "--input"} with "error.no-input-parameter" as the error is not missing argument of `--input` parameter, but missing `--input` parameter itself.
- CommandLine.parse() doesn't throw `java.io.FileNotFoundException` when command file is no found. Instead it throws `java.nio.file.NoSuchFileException`.
- Remove negative tests from AppVersionTest. ErrorTest tests invalid app versions better, it verifies error messages in jpackage output, AppVersionTest doesn't.
- Enhance RuntimePackageTest to test that jpackage can derive package name from the runtime image directory name if `--name` option is not given
- LinuxResourceTest: use CannedFormattedString
- ... and 23 more: https://git.openjdk.org/jdk/compare/caaf4098...eda0efec
Changes: https://git.openjdk.org/jdk/pull/23936/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23936&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8351372
Stats: 2111 lines in 37 files changed: 1377 ins; 459 del; 275 mod
Patch: https://git.openjdk.org/jdk/pull/23936.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23936/head:pull/23936
PR: https://git.openjdk.org/jdk/pull/23936
More information about the core-libs-dev
mailing list