-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Support runtest.py to work on Windows when no_pty=True #640
Conversation
I briefly tested it and it seemed to add some strange token at the end of each line, like This caused both my VBScript implementation and the repository's original PowerShell implementation by Joel Martin to fail the test (although it produced the expected results). |
Thanks for your feedback. The special character As I have no clear Idea about how the string I've tested the powershell implementation by Joel Martin from step0 to step9, and the tests passed smoothly. Except for the step5, you might wants to increase Regarding stepA, there is an hanging issue when testing |
Thanks for update. But when I test step0 with PowerShell impl, got this:
I fix it:
with this:
Then step0 of powershell & vbs can pass smoothly. And when I test step1, With powershell I got these 'FAILURES':
With my vbs impl, It stuck in
So I test my vbs's step1 with pipe:
It did not get stuck and generate the expected result.
And then I manually test all tests in Here is my test script (Batch File, placed in same folder with
May I ask what your PowerShell testing environment is? I think there may be slight differences in our environment, which may result in your PowerShell testing passing while mine cannot. |
Fix the hanging issue when testing `(readline "mal-user> ")` on powershell stepA_mal.ps1 implementation. The issue is found on Windows and Windows WSL Ubuntu.
I fix the hanging issue when testing on stepA. I test from step0 to stepA again for all my environments and the runtest.py script runs smoomthly. I have two testing environments, which are:
To test in my first environment, I use the following script. @echo off
@REM test.cmd
@REM Put this script in the same directory as the runtest.py file
@REM # How to run
@REM # O. Start In powershell shell environment
@REM # 1. Change to Mal project directory
@REM cd path\to\mal
@REM # 2. Run the test and log the result
@REM .\test.cmd | Tee-Object -FilePath test-nt.log
for %%a in (
step0_repl
step1_read_print
step2_eval
step3_env
step4_if_fn_do
step5_tco
step6_file
step7_quote
step8_macros
step9_try
stepA_mal
) do (
python runtest.py --rundir "impls\powershell" --test-timeout 60 --deferrable --optional --no-pty "..\tests\%%a.mal" powershell ".\%%a.ps1"
) To test in my second environment, I use the following script. #!/usr/bin/bash
# test.bash
# Put this script in the same directory as the runtest.py file
# How to run
# # 1. Change to Mal project directory
# cd path/to/mal
# # 2. Run the test and log the result
# bash test.bash | tee test-posix.log
names=(
step0_repl
step1_read_print
step2_eval
step3_env
step4_if_fn_do
step5_tco
step6_file
step7_quote
step8_macros
step9_try
stepA_mal
)
for name in "${names[@]}"
do
python runtest.py --rundir "impls/powershell" --test-timeout 60 --deferrable --optional --no-pty "../tests/${name}.mal" pwsh "${name}.ps1"
done One could refer to the attached files for the test log. |
@OldLiu001 couldn't reproduce your issue on my machine though, hope the infomation above could help you located the problem. |
I finally discovered the root cause of the problem. In Windows, git defaults to changing the line feed encoding of the cloned text file to CRLF, while Resulting in an additional |
@cy20lin Thank you for your work on this. @OldLiu001 and I figured out a way to use WSL on Windows plus the runtest |
Tweak runtest.py script so that it could now partially run on Windows. The pty part is not implemented, and would raise if --no-pty is not specified.
For the implementation, the threading and queue modules are used to read the subprocess.stdout pipe with timeout, as the select module doesn't work on Windows.