RFR: 8316412: javax/print tests fail without printer set up

Phil Race prr at openjdk.org
Mon Sep 25 19:03:03 UTC 2023


On Tue, 19 Sep 2023 14:45:47 GMT, Michal Sobierski <duke at openjdk.org> wrote:

> For NullClipARGB we are throwing SkippedException only if instance of caught exception is PrinterException. All other exceptions are considered unrelated to printer configuration.
> 
> For CountPrintServices we want to throw SkippedException in the case when lpstat is not installed, where an IOException is caught in that case.
> 
> For ExceptionTest we want to throw SkippedException for all PrinterExceptions which were not caused by IndexOutOfBoundsException.
> 
> For rest of the tests if PrintService was not created instead RuntimeException we are throwing now SkippedException.
> 
> Tested on environment without printer installed.
> Test are passing with skipped exception as expected.
> 
> Passed: java/awt/print/PrinterJob/ExceptionTest.java
> Passed: java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java
> Passed: java/awt/print/PrinterJob/PrtException.java
> Passed: javax/print/attribute/AttributeTest.java
> Passed: javax/print/attribute/GetCopiesSupported.java
> Passed: javax/print/attribute/SidesPageRangesTest.java
> Passed: javax/print/attribute/SupportedPrintableAreas.java
> Passed: javax/print/PrintServiceLookup/CountPrintServices.java
> Passed: javax/print/CheckDupFlavor.java
> 
> Additionally unused imports have been removed.

Just like
@key headful
is used for headful tests, these tests have
@key printer
which you are supposed to use to exclude them if you don't have a printer configured., eg

jtreg -k:!printer ...

In other words none of these changes should be necessary and I'm fairly sure are actually undesirable in some cases.
Notably skipping if lpstat isn't installed and you are trying to test printing is bad.

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

PR Comment: https://git.openjdk.org/jdk/pull/15821#issuecomment-1734303824


More information about the client-libs-dev mailing list