mal icon indicating copy to clipboard operation
mal copied to clipboard

Tests don't work on native Windows

Open AP2008 opened this issue 4 years ago • 5 comments

Tests doesn't seem to work on native windows. Are there any fixes on it ? This is the output after running mingw32-make to test:

mingw32-make "test^lisp^step0"

C:/MyProgs/TDM-GCC-64/bin/mingw32-make -C impls/lisp step0_repl.lisp
mingw32-make[1]: Entering directory 'C:/user/Work/mal/impls/lisp'
mingw32-make[1]: Nothing to be done for 'step0_repl.lisp'.
mingw32-make[1]: Leaving directory 'C:/user/Work/mal/impls/lisp'
(call STEP_TEST_FILES,lisp,step0): impls/tests/step0_repl.mal
----------------------------------------------
Testing test^lisp^step0; step file: impls/lisp/step0_repl.lisp, test file: tests/step0_repl.mal
Running: env STEP=step0_repl MAL_IMPL=js ../../runtest.py  --deferrable --optional   ../tests/step0_repl.mal -- ../lisp/run
Traceback (most recent call last):
  File "C:\user\runtest.py", line 12, in <module>
    import pty, array, fcntl, termios
  File "Python39\lib\pty.py", line 12, in <module>
    import tty
  File "Python39\lib\tty.py", line 5, in <module>
    from termios import *
ModuleNotFoundError: No module named 'termios'
Makefile:410: recipe for target 'test^lisp^step0' failed
mingw32-make: *** [test^lisp^step0] Error 1

AP2008 avatar Nov 27 '20 05:11 AP2008

The problem is you're running Python 3.9 and the runtest.py script is written to Python 2. (I just had the same problem.)

That's why it can't import the termios module, I think. No, I'm wrong. Python 3 has that lib but "It is only available for those Unix versions that support POSIX termios style tty I/O control configured during installation.", so... hmm.

calroc avatar Jan 03 '21 18:01 calroc

@AP2008 @calroc sorry for the really slow followup. I basically took a long break from open source/mal stuff.

It probably wouldn't be that hard to conditionalize the termios import and usage (in just a single place). That might not be the only Windows incompatibility though. I don't have easy access to a Windows system to do these changes (nor the motivation). However, I'm willing to review and merge changes to enable Windows support as long as they are straight forwards and clean changes that don't add complication or problems for running under Linux.

kanaka avatar Apr 21 '21 23:04 kanaka

On Wed, Apr 21, 2021 at 04:36:40PM -0700, Joel Martin wrote:

@AP2008 @calroc sorry for the really slow followup. I basically took a long break from open source/mal stuff.

No prob, these things happen. :)

You know mal is on HN front page today? https://news.ycombinator.com/item?id=26924344

It probably wouldn't be that hard to conditionalize the termios import and usage (in just a single place). That might not be the only Windows incompatibility though. I don't have easy access to a Windows system to do these changes (nor the motivation). However, I'm willing to review and merge changes to enable Windows support as long as they are straight forwards and clean changes that don't add complication or problems for running under Linux.

I'll take a whack at it soon and see if I can't get a decent PR together.

Great project BTW, I really enjoyed it even though I didn't finish an implementation.

calroc avatar Apr 25 '21 00:04 calroc

@kanaka I ran into the same issue. It is easy to circumvent by using the Windows Subsystem for Linux (WSL), at least in my use case, but on a broader level shouldn't the tests be updated to rely on Python 3 since Python 2 is no longer supported?

differentsmoke avatar Jun 03 '21 16:06 differentsmoke

I made a pull request (https://github.com/kanaka/mal/pull/640) which enable the runtest.py script to run mal implementation tests on Windows. You may refer to that PR and see if the script helps.

cy20lin avatar Jul 09 '23 23:07 cy20lin