RFR: 8344911: Introduce test utility for asserting file open status [v2]

Eirik Bjørsnøs eirbjo at openjdk.org
Fri Nov 29 19:53:37 UTC 2024


On Mon, 25 Nov 2024 17:19:41 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

>> Please review this PR which  adds a utility API in the test libraries to assert whether a file is currently open.
>> 
>> Several OpenJDK  tests currently rely on approximations to check this, including deletion (fails only on Windows), or checking `/proc/<pid>/fd` (Works only on Linux). These approximations are blunt instruments, it would be better to have an exact cross platform solution for this need to check if a file is open or closed.
>> 
>> Verification: With `OpenFilesTest` temporarily in tier1, GHA completed successfully across platforms.
>
> Eirik Bjørsnøs has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Test infrastructure to assert that a file is open or closed

Alright, after trying to use this utility for writing some more actual tests, I think it is a bit immature to consider this for integration in the current state.

While answering the question "is this particular file open at this exact moment?" is useful, being able to reason about files opened or closed within some code block/scope seems a lot more powerful and attractive. It would also make the utility less intrusive to unrelated code in the instrumented JVM and specifically it would isolate different tests opening the same files. 

Future work may be explored in this branch. Stay tuned :-)

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

PR Comment: https://git.openjdk.org/jdk/pull/22343#issuecomment-2508511797


More information about the core-libs-dev mailing list