Integrated: CODETOOLS-7903223: Enable no-display-required parts of Basic tests in HEADLESS mode
Jonathan Gibbons
jjg at openjdk.org
Fri Jul 1 13:37:07 UTC 2022
On Fri, 1 Jul 2022 05:40:31 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
> Please review a mostly-test-only fix to run more tests when running in HEADLESS mode, such as in GitHub Actions.
>
> 4 jtreg self-tests, including the important `Basic` tests, involve test suites with `@run applet` tests. These tests fail on a headless system, and were previously disabled on such systems by using `ifndef HEADLESS` to exclude the tests from execution. But these tests exercise more than just applet functionality, and excluding the entire test is too drastic a solution.
>
> The change is to always enable these tests, modifying their behavior to avoid using the parts of the test that use `@run applet`.
>
> The changes fall into 5 groups:
>
> 1. `Agent.java` ... if the `java.awt.headless` property is set in jtreg, it is propagated to any agents that are started. This is primarily for testing/debugging. The property does not normally need to be set, even on a headless system.
>
> 2. The `Basic` tests ... a new keyword is added to those tests in the `basic` suite that should not be run in headless mode, which is determined automatically by calling `GraphicsEnvironment.isHeadless()`. The expected number of tests in different categories is adjusted accordingly. Note that bad/malformed tests using `@run applet` are not affected, because they result in an `Error` result and the action is never invoked.
>
> 3. `ReportOnlyTest` ... this is a follow-up to the `Basic` tests, to verify the test counts are reported accurately in report-only mode. If HEADLESS is set, the expected numbers of passed and failed tests are adjusted.
>
> 4. `EnvTests` ... as with the `Basic` tests, a new keyword is added to applet tests, so that if HEADLESS is set, the applet tests are not executed. The tests are also modified to use JDK 8 and 9 as older versions, instead of JDK 6 and 7.
>
> 5. `Rerun tests` ... similar to the preceding cases. If HEADLESS is set, the applet tests are not executed, the expected number of tests is modified, and the applet tests are ignored when checking the rerun info.
>
> ## Testing
>
> Locally, the modifications are tested by a combination of setting `-Djava.awt.headless=true` for the `Basic` tests and `HEADLESS` for the other tests.
>
> More notably, the `Basic` and `ReportOnlyTest` tests are seen to be executed, and pass, in the Github Actions for the repo.
This pull request has now been integrated.
Changeset: f16f3061
Author: Jonathan Gibbons <jjg at openjdk.org>
URL: https://git.openjdk.org/jtreg/commit/f16f3061296fafacba6db8e338448d901a92cac5
Stats: 118 lines in 18 files changed: 82 ins; 14 del; 22 mod
7903223: Enable no-display-required parts of Basic tests in HEADLESS mode
Reviewed-by: iris
-------------
PR: https://git.openjdk.org/jtreg/pull/92
More information about the jtreg-dev
mailing list