On Thu, 21 Mar 2024 14:41:36 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
>> Bill Huang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Implemented review comments > > test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java line 57: > >> 55: >> 56: File flagsFile = File.createTempFile("CheckOriginFlags", >> null); >> 57: flagsFile.deleteOnExit(); > > Hello Bill, jtreg uses a scratch directory when running tests. When a test is > launched, the current working directory points to the scratch directory for > the test that's currently executing. jtreg manages the lifecycle of scratch > directories and even cleans them up (as necessary). > Would it instead be better to just create the temporary file within the jtreg > scratch directory (represented by the current working directory)? That way > you could just do: > > > File flagsFile = Files.createTempFile(Path.of("."), "CheckOriginFlags", > null).toFile(); > > and don't need any explicit deletions? Hi Jaikiran, I think both solutions work for this bug. I personally prefer to place the files in the scratch directory for the ease of debugging. In addition, for this specific test, I am considering using File.createTempFile("CheckOriginaFlags", null, Path.of(".").toFile) instead of Files.createTempFile for consistency purposes, as Files.createTempFile may have more restrictive access permissions. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18352#discussion_r1534283105