RFR: 7903953: Use scratch directory for JUnit's TempDir annotation [v3]

Christian Stein cstein at openjdk.org
Tue Feb 25 07:55:44 UTC 2025


> Please review this change to use `jtreg`'s scratch directory for JUnit's `@TempDir` annotation.
> 
> Prior to this change, the standard implementation of JUnit Jupiter using the system default temporary directory is active, effectively decoupling the location of "interesting on failure" files from `jtreg`:
>> When `jtreg` executes a test, the current directory for the test is set to a scratch directory so that the test can easily write any temporary files.
> 
> Find more details about `jtreg`'s scratch directory at https://openjdk.org/jtreg/faq.html#scratch-directory
> 
> In addition to use the current working directory for `@TempDir` annotated paths, this change also switches off JUnit's built-in cleanup of temporary files - leaving it to `jtreg` to care about it, see for example the help message for  the `-retain` command-line option:
> 
> 
>     -retain | -retain:<pass,fail,error,all,file-pattern>,...
>                     Specify files to be retained after each test completes
>                     executing. If -retain is not specified, only the files from
>                     the last test executed will be retained. If -retain is
>                     specified with no argument, all files will be retained.
>                     Otherwise, the files may be described by one or more of the
>                     following values:
>         none            Do not retain any of the files generated by each test
>         pass            Retain files generated by tests that pass
>         fail            Retain files generated by tests that fail
>         error           Retain files generated by tests that caused an error
>         all             Retain all files generated by each test
>         file-pattern    Retain files that match a specific filename. The name
>                         may contain '*' to match any sequence of characters. For
>                         example, result.* or *.err.

Christian Stein has updated the pull request incrementally with one additional commit since the last revision:

  Add comment

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

Changes:
  - all: https://git.openjdk.org/jtreg/pull/248/files
  - new: https://git.openjdk.org/jtreg/pull/248/files/296bb50e..fcbb24de

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jtreg&pr=248&range=02
 - incr: https://webrevs.openjdk.org/?repo=jtreg&pr=248&range=01-02

  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jtreg/pull/248.diff
  Fetch: git fetch https://git.openjdk.org/jtreg.git pull/248/head:pull/248

PR: https://git.openjdk.org/jtreg/pull/248


More information about the jtreg-dev mailing list