On Tue, 26 Mar 2024 18:18:39 GMT, Bill Huang <bhu...@openjdk.org> wrote:

>> This task addresses an essential aspect of our testing infrastructure: the 
>> proper handling and cleanup of temporary files and socket files created 
>> during test execution. The motivation behind these changes is to prevent the 
>> accumulation of unnecessary files in the default temporary directory, which 
>> can affect the system's storage and potentially influence subsequent test 
>> runs.
>> 
>> Our review identified that several tests create temporary files or socket 
>> files without ensuring their removal post-execution. 
>> - Direct calls to java.io.File.createTempFile and 
>> java.nio.file.Files.createTempFile without adequate cleanup.
>> - Tests using NIO socket channels with StandardProtocolFamily.UNIX, not 
>> explicitly removing socket files post-use.
>
> Bill Huang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update test/jdk/java/nio/channels/unixdomain/Bind.java
>   
>   Co-authored-by: Andrey Turbanov <turban...@gmail.com>

For the changes in `test/jdk/java/nio/file/Files/CheckPermissions.java` it 
would be good to have Alan and/or Brian's inputs. The test documentation says 
that the test relates to SecurityManager checks (and not filesystem permission 
checks), so the proposed changes in this PR to use a different parent directory 
for the temporary file(s) should be OK, but I am not familiar with that area to 
be certain about it.

test/jdk/sun/security/pkcs12/P12SecretKey.java line 69:

> 67: 
> 68:         File ksFile = File.createTempFile("test", ".test");
> 69:         ksFile.deleteOnExit();

Is there a reason why this change is done differently than the rest of the 
changes in this PR? Can we delete the `File` in a try/finally instead of 
enrolling a shutdown hook to delete it?

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

PR Comment: https://git.openjdk.org/jdk/pull/18352#issuecomment-2032269381
PR Review Comment: https://git.openjdk.org/jdk/pull/18352#discussion_r1548045308

Reply via email to