Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase Timeout and Improve Windows Compatibility in Basic.java Test #23933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asilichenko
Copy link

@asilichenko asilichenko commented Mar 6, 2025

Warning

Hi, I’ve created this pull request, but I don’t have the necessary permissions to create an issue for it. Could someone please create an issue to track this change? I’m not sure who to contact directly, so any help would be appreciated.

Thank you!

This PR proposes three improvements to the Basic.java test:

  1. Increase Timeout

    • The current timeout is insufficient when running the test in IntelliJ IDEA.
    • I propose increasing it by one minute.
    • The timeout value was last modified on May 13, 2010 (commit 56131863a71c) and has remained unchanged since then.
  2. Fix Incompatibility with Windows (Cygwin vs. Native)

    • One of the tests executes the echo command.
    • This works in Cygwin but fails when running the test in a pure Windows environment (e.g., IntelliJ IDEA).
    • I propose replacing echo with cmd /c echo., which produces the same output (a single newline) in Windows, ensuring compatibility.
  3. Prevent Autorun Scripts in the cmd /c set Command

    • The test runs cmd /c set, but in Windows, this may trigger autorun scripts.
    • I propose adding the /d options to prevent autorun scripts from affecting the test results.

These changes improve test reliability and ensure compatibility across different environments.
Testing:

  • Verified that the test runs successfully in IntelliJ IDEA without timeout issues.
  • Confirmed that cmd /c echo. produces the expected output in Windows.
  • Ensured that cmd /d /c set correctly lists environment variables without executing autorun scripts.

Detailed Description

echo

The following test fails in a clean Windows environment (e.g., when run from IntelliJ IDEA without Cygwin):

//----------------------------------------------------------------
// Test Runtime.exec(...envp...) with envstrings without any `='
//----------------------------------------------------------------

with following error:

Cannot run program "echo": CreateProcess error=2, The system cannot find the file specified

cmd.exe /c set

The following test fails in a Windows environment under specific conditions:

//----------------------------------------------------------------
// Test Runtime.exec(...envp...)
// Check for sort order of environment variables on Windows.
//----------------------------------------------------------------

with following error:

>'+=+
BAZ=GORP
CONDA_BAT=C:\\.......\\miniconda3\\condabin\\conda.bat
CONDA_EXE=C:\\........\\miniconda3\\Scripts\\conda.exe
CONDA_SHLVL=0
FOO=BAR
PATH=C:\\.........\\miniconda3\\condabin;
QUUX=
SystemRoot=C:\\WINDOWS
_=_
~=~
'< not equal to '+=+
BAZ=GORP
FOO=BAR
QUUX=
SystemRoot=C:\\WINDOWS
_=_
~=~
'

Reason
In my environment, Miniconda was installed, which adds a script execution to the autorun of cmd. This script sets additional environment variables that break this test.

To reproduce this bug, you can manually add a custom script to the autorun. I have described the steps in detail in my article: AutoRun for Windows Command Processor (cmd.exe).

Changes

  • increase timeout by one minute
  • remove unused import

For Windows

  • add /d to winEnvCommand - to disable the execution of AutoRun commands
  • replace echo with cmd /c echo.

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23933/head:pull/23933
$ git checkout pull/23933

Update a local copy of the PR:
$ git checkout pull/23933
$ git pull https://git.openjdk.org/jdk.git pull/23933/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23933

View PR using the GUI difftool:
$ git pr show -t 23933

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23933.diff

- remove unused import
- increase timeout by one minute

For Windows:
- add "/d" to `winEnvCommand` - to disable the execution of AutoRun commands
- replace "echo" with "cmd /c echo."
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 6, 2025

👋 Welcome back asilichenko! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 6, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Mar 6, 2025

@asilichenko The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant