Tighten up jpackage's output validation.

 - Support separate validation of jpackage's stdout and stderr. Previously, 
validation was applied to the merged stdout and stderr output, so errors were 
not detected when jpackage expected to write to stdout but wrote to stderr 
instead
- 99% of test cases in ErrorTest will check that jpackage's stderr contains 
exact expected error messages and doesn't contain additional text lines
- Use `String.equals()` instead of `String.contains()` when validating strings 
from jpackage string bundles in jpackage output

Replace TKit.TextStreamVerifier.Group class with a more capable 
JPackageOutputValidator.

Fix revealed issues:
 - jdk.jpackage.internal.AppImageSigner: use `Log.fatalError()` to report a 
fatal signing error instead of `Log.info()`. This change directs signing error 
messages to stderr, where all warnings and errors belong, rather than stdout.
 - On macOS, when the value of the "--app-image" option is not a directory, 
jpackage used to report two errors: that the value is not a directory and that 
it is not a macOS bundle. This behavior has changed: jpackage will report only 
the first error. If the value of the "--app-image" option is a directory that 
is not a valid macOS bundle, jpackage will fail with the corresponding error.

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

Commit messages:
 - JPackageCommand: split validateOutput() in validateOut() and validateErr(); 
add convenience makeError() and makeAdvice() methods; fix cannedArgument() 
signature; Add JPackageOutputValidator for finer control of jpackage output 
validation; Use String#equals() instead of String#contains() predicate when 
validating canned formatted strings in jpackage output; 
TKit.TextStreamVerifier: remove Group class. It duplicates 
JPackageOutputValidator functionality and can be replaced with Stream.reduce() 
where JPackageOutputValidator is not applicable.
 - Validator: Split and() into andGreedy() and andLazy(); On macOS, when the 
value of the "--app-image" option is not a directory, don't report two errors 
that it is not a directory and not a valid macOS bundle, report on;y the first 
error.
 - JPackageCommand: fix ReadOnlyPathAssert.Builder.create(): it should check 
that jpackage command line contains configured option before running the 
enabling predicate.
 - MacSign: fix a typo: CODE_SIGND -> CODE_SIGN
 - AppImageSigner: report signing error into stderr instead of stdout

Changes: https://git.openjdk.org/jdk/pull/29644/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29644&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377629
  Stats: 965 lines in 27 files changed: 635 ins; 118 del; 212 mod
  Patch: https://git.openjdk.org/jdk/pull/29644.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29644/head:pull/29644

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

Reply via email to