**Reduce disk usage in jlink tests**

Several jlink tests accumulate large image directories on disk without cleaning 
them up, causing significant disk space usage -  especially in fastdebug builds 
where images include big native debug symbols. This change addresses that in 
three ways:

Image size reduction:
Added `--strip-debug` to jlink invocations in ~30 test files where it is safe 
to do so (i.e. the test only checks functional correctness - module presence, 
exit codes, stdout but not further things like binary equality).  Tests that 
compare images byte-for-byte `(JLinkReproducible*, 
PackagedModulesVsRuntimeImageLinkTest`) are unchanged.

Per-test cleanup:
Added `@AfterEach/@AfterMethod` cleanup to JUnit 5 and TestNG tests that create 
multiple images (`IncludeLocalesPluginTest, GenerateJLIClassesPluginTest, 
LegalFilePluginTest, ExcludeJmodSectionPluginTest, UserModuleTest and 
JLinkTest`). This reduce disk pressure by deleting no longer needed images.

Intermediate image cleanup in `AbstractLinkableRuntimeTest` tests:
`AbstractLinkableRuntimeTest.createJavaImageRuntimeLink()` now deletes the 
intermediate linkable-runtime JDK image immediately after it has been used to 
produce the final output image. And `createRuntimeLinkImage()` deletes the 
--generate-linkable-runtime temporary image as soon as it has been copied. This 
reduces peak disk usage in JavaSEReproducibleTest and other 
`AbstractLinkableRuntimeTest` subclasses from 6 simultaneous images to 2. 
`JLinkReproducible2Test` and `JLinkReproducible3Test` also sequence their image 
pairs so at most one pair exists at a time.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Delete intermediate images in AbstractLinkableRuntimeTest this will improve 
several tests.
 - Reduce disk usage of JLinkReproducible2Test
 - Reduce disk usage by deleting copied jdks directly after jlink calls - only 
created images are compared
 - Modify 8 more test that are safe for --strip-debug.
 - Add --strip-debug to 5 more tests.
 - Cleanup in-between tests of JLinkTest and use --strip-debug where applicable.
 - Cleanup image-dirs in-between test-methods in UserModuleTest and in the end.
 - Add in-between cleanup to LegalFilePluginTest and 
ExcludeJmodSectionPluginTest
 - Use --strip-debug where it is feasible
 - Further test improvements.
 - ... and 1 more: https://git.openjdk.org/jdk/compare/2e179fec...ee24c18a

Changes: https://git.openjdk.org/jdk/pull/32009/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32009&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8375623
  Stats: 266 lines in 28 files changed: 165 ins; 46 del; 55 mod
  Patch: https://git.openjdk.org/jdk/pull/32009.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32009/head:pull/32009

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

Reply via email to