RFR: 8321192 : j.a.PrintJob/ImageTest/ImageTest.java: Fail or skip the test if there's no printer
Alexey Ivanov
aivanov at openjdk.org
Fri Feb 9 19:41:04 UTC 2024
On Fri, 9 Feb 2024 19:27:32 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> > I thought SkippedException looks like a "pass" too ?
> > What is effectively different by using it here ?
>
> No, it's not. If a test throws `jtreg.SkippedException`, then it's reported as **skipped**. It is neither a failure nor a success — it indicates the prerequisites aren't met.
**jtreg FAQ: [What if a test does not apply in a given situation?](https://openjdk.org/jtreg/faq.html#what-if-a-test-does-not-apply-in-a-given-situation)**
“While `@modules` and `@requires` will cover many cases, there may be cases where the determination of whether the test is applicable needs to be determined by the test itself. For example, a test may want to check the presence of a shared library containing compiled native code, and to skip the main body of the test if the library is not available. <em>In such cases, a test may throw an exception named `jtreg.SkippedException`. […] This exception will be treated specially: unlike for any other exception, the test will be deemed to have passed, but the reason will be set to a message saying that the test was skipped instead of executing normally.</em>”
@prrace Does it explain `jtreg.SkippedException`?
However, `@key printer` also covers the condition in this case.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17790#issuecomment-1936497826
More information about the client-libs-dev
mailing list