RFR: 8347740: java/io/File/createTempFile/SpecialTempFile.java failing [v3]

Daniel Jeliński djelinski at openjdk.org
Fri Jan 17 17:08:36 UTC 2025


On Fri, 17 Jan 2025 16:46:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> test/jdk/java/io/File/createTempFile/SpecialTempFile.java line 95:
>> 
>>> 93: 
>>> 94:         String cmd = "Systeminfo";
>>> 95:         Process p = Runtime.getRuntime().exec(new String[] {cmd});
>> 
>> I'm not a big fan of running third-party tools in our tests; did you try fixing the regex expression?
>> Replace: `"^.*[11|2025]$"` (character class) -> `"^.*(11|2025)$"` (alternative strings)
>
> No, I replaced it with splitting the OS version string. In any case, would that cover, e.g., the hypothetical cases Windows 27, Windows Server 2038, etc.?
> 
> Unfortunately Miscrosoft does not provide a reliable API to obtain the build number. `GetVersionEx` is deprecated. [KUSER_SHARED_DATA](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-kuser_shared_data) contains `NtBuildNumber` but some device driver kit has to be installed to use it.
> 
> Also, [IsWindows10OrGreater](https://learn.microsoft.com/en-us/windows/win32/api/versionhelpers/nf-versionhelpers-iswindows10orgreater) returned `false` on my Windows 11 machine so it is suspicious, and [IsWindowsVersionOrGreater](https://learn.microsoft.com/en-us/windows/win32/api/versionhelpers/nf-versionhelpers-iswindowsversionorgreater) would require being able to know the service pack number of a particular build which I am not sure is possible,

No, it wouldn't cover any future Windows versions, but it would definitely buy us a few years.

Regarding a more permanent solution: the test is supposed to verify the fix for [JDK-8013827](https://bugs.openjdk.org/browse/JDK-8013827). I think it should accept both outcomes (success and the specific exception); the only unacceptable outcomes are:
- timeout,
- unexpected exception.

We don't need to know the exact Windows version to verify that the test doesn't time out.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23117#discussion_r1920491885


More information about the core-libs-dev mailing list