On Thu, 14 May 2026 23:33:54 GMT, Ashay Rane <[email protected]> wrote:

>> The powershell binary is required to run these tests but in the GitHub
>> workflow that runs tests (specifically, in test.yml), we reset the PATH
>> environment variable on Windows, causing the GitHub workflow to fail if
>> you run these tests.  The tests pass locally since local test runs don't
>> modify PATH.
>> 
>> To make these tests pass in GitHub workflows, this patch updates the
>> tests to refer to PowerShell using the canonical path on Windows.  See
>> https://github.com/raneashay/openjdk-jdk/actions/runs/25680763981/job/75401590988
>> for a sample workflow run of the tier2 part1 tests, which include the
>> CngCipher and DupAlias tests.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Ashay Rane has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Address PR comments and fix more failing tests
>   
>   1. Moved `PowerShellPath()` function to jdk.test.lib.util.FileUtils.
>   
>   2. Updated `PowerShellPath()` so that if the file doesn't exist, we
>      default to the original string.
>   
>   3. Replaced more instances of `"powershell"` to `PowerShellPath()` and
>      added the standard Windows directories to the Win836570 test (so that
>      it can launch the JVM).  This now makes all related tier2 and tier3
>      tests in the test/jdk directory to pass.
>   
>   4. Replaced `"ping"` with `%%SystemRoot%%\\System32\\ping.exe` since
>      this string is passed to `cmd /C`, which doesn't have the same
>      resolution steps as `CreateProcess()`, which looks for binaries in
>      the Windows\System32 directory if the directory part is not
>      specified.

Also copyrights :)

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java line 665:

> 663:     private static final int WIN_MAX_PATH = 260;
> 664: 
> 665:     public static String PowerShellPath() {

Can you use `fileUtils` one here? or is there a catch?

test/lib/jdk/test/lib/util/FileUtils.java line 479:

> 477:     };
> 478: 
> 479:     public static String PowerShellPath() {

Nit: 
Suggestion:

    public static String powerShellPath() {

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

PR Review: https://git.openjdk.org/jdk/pull/31127#pullrequestreview-4312394919
PR Review Comment: https://git.openjdk.org/jdk/pull/31127#discussion_r3260894349
PR Review Comment: https://git.openjdk.org/jdk/pull/31127#discussion_r3260883977

Reply via email to