RFR: 8320608: Many jtreg printing tests are missing the @printer keyword
Phil Race
prr at openjdk.org
Mon Nov 27 19:29:23 UTC 2023
On Thu, 23 Nov 2023 20:39:50 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> test/jdk/java/awt/print/PageFormat/SetOrient.java line 28:
>>
>>> 26: * @summary Confirm that the clip and transform of the Graphics2D is
>>> 27: * affected by the landscape orientation of the PageFormat.
>>> 28: */
>>
>> Since this test calls `pjob.print();`, it requires a printer. Indeed, it fails without a printer:
>>
>>
>> runner starting test: java/awt/print/PageFormat/SetOrient.html
>> runner finished test: java/awt/print/PageFormat/SetOrient.html
>> Failed. Execution failed: Applet thread threw exception:
>> java.lang.RuntimeException: No print service found.
>> Test results: failed: 1
>
> I see `SetOrient.java` has its sibling `SetOrient.html` where you added `@key printer`.
>
> Since both files contain all the tags except for `@test` in the .java file, you should not remove the `@run` tag from the .java file and add `@key printer` to it.
"Should not" is strong. Why ? There's no requirement do to this even though you can.
https://openjdk.org/jtreg/faq.html#can-i-use-the-author-run-etc.-tags-in-other-files
>> test/jdk/java/awt/print/PageFormat/SmallPaperPrinting.java line 42:
>>
>>> 40: System.out.println("A passing test should catch a PrinterException");
>>> 41: System.out.println("and should display \"Print error: (exception msg)\".");
>>> 42: System.out.println("---------------------------------------------------\n");
>>
>> According to these instructions, the test is to contain a set of `@test` tags:
>>
>>
>> /*
>> * @test
>> * @key printer
>> * @run main/othervm SmallPaperPrinting
>> */
>>
>> /*
>> * @test
>> * @key printer
>> * @run main/othervm SmallPaperPrinting 1
>> */
>>
>> /*
>> * @test
>> * @key printer
>> * @run main/othervm SmallPaperPrinting 2
>> */
>>
>>
>> Otherwise, it won't run all the cases and no one will ever see these instructions.
>>
>> For me, the test with the added `@test` tags as above prints an error message in the first two cases:
>>
>> # id0.jtr
>> Print error:
>> Paper's imageable height is too small.
>> # id1.jtr
>> Print error:
>> Paper's imageable width is too small.
>>
>>
>> Yet it does not print any error message in the third case where `width=-1`, and **it does not fail**.
>>
>> If I run it on a system without a printer, the test also *passes successfully*. Perhaps, we can ignore it as the `@key printer` ensures there's a printer the system.
>>
>> Having said the above, this test requires its own bug to fix the test.
>
>> Having said the above, this test requires its own bug to fix the test.
>
> I submitted [JDK-8320671](https://bugs.openjdk.org/browse/JDK-8320671): PageFormat/SmallPaperPrinting.java needs three sets of @test tags
I saw that, and it didn't fail at all on mac for any case.
Not sure how much I want to get dragged into fixing the test, and there's no bug id to refer back to.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16785#discussion_r1406605795
PR Review Comment: https://git.openjdk.org/jdk/pull/16785#discussion_r1406627015
More information about the client-libs-dev
mailing list