On Mon, 28 Jul 2025 10:00:27 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
>>> I'm not completely sure where it creates those temporary directories. >> >> JUnit `@TempDir` uses the JTreg scratch directory – [JTreg >> 7.5.2](https://github.com/openjdk/jtreg/blob/master/CHANGELOG.md#752) >> bundles >> [CODETOOLS-7903953](https://bugs.openjdk.org/browse/CODETOOLS-7903953) >> addressing this issue. Shall I still replace these with `Files::cTD`? Or >> `jdk.test.lib.Utils::createTempFile`? > > Can you verify how it behaves with the `-retain` option of jtreg? I think the > use of `cleanup` attribute here can conflict with the `-retain` option that > can be used to launch `jtreg`. If it is possible to instruct JUnit to not do > any cleanup at all, then I think using `@TempDir` here is OK (since as you > note, it will end up using the jtreg scratch directory). If JUnit cannot be > instructed not to do any cleanup, then using `@TempDir` here would add > another layer of potential issue if jtreg was launched with `-retain:all` > (for example). Indeed JUnit's `CleanupMode.ON_SUCCESS` does not honor JTreg's `-retain` – I will follow-up on this. That said, without a `CleanupMode`, it all works as expected – I decided to go with that in 99503c0bac7. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26155#discussion_r2242069829