Test: SIGINT should be able to interrupt non-terminating goals on linux#3299
Test: SIGINT should be able to interrupt non-terminating goals on linux#3299danilp-id wants to merge 12 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
96300bf to
c914cd1
Compare
|
See https://unix.stackexchange.com/questions/249723/how-to-trick-a-command-into-thinking-its-output-is-going-to-a-terminal for ways to simulate terminal. It also includes a way to make it work on all unixes by injecting a dummy shared library. |
|
This might work for all unixes and only require python as dependency https://unix.stackexchange.com/questions/249723/how-to-trick-a-command-into-thinking-its-output-is-going-to-a-terminal#answer-564841 |
… this work on macos
|
Huh, that's really weird. Why does it now pass on everything except for macos and ubuntu x86? It still fails if I run the test locally. Can someone check? |
|
I don't know why it fails on these systems, but one general comment: The Python script looks so small that maybe it could become a Scryer program? Is there anything we need for example in |
|
@triska we can do it like |
I don't think it's currently possible to configure that using the underlying rust API. |
|
Yes, but we can use something like portable_pty. As a bonus, it also supports windows. |
|
@danilp-id thanks for this test case! It's great to be testing Scryer's REPL behavior across multiple platforms. It would be beneficial to have a complete test suite for as much of REPL's user interaction as possible to detect future regressions like the one caused by updating |
|
@abmclin Thanks! The rustyline issue is unix-only, but on windows there is ConPTY which I think can be tested using pywinpty for example. I think for now it's ok to just make a small python wrapper script to test issues like these instead of adding pseudoterminal support directly to process library (and I am not sure if it would really be that useful to add it there since anyone can just use a wrapper script if the need arises). |
Test for #3290.
Currently fails, but passes if that PR is applied.
Works by creating a child scryer process wrapped in
scriptto simulate a terminal and then sending INT signals to it. (If terminal is not simulated, bug will not appear.)Also reworked tests to use
#[tokio::test(flavor = "multi_thread")]instead of custom tokio initialization code.TODO (in a different PR): currently, there is no way to detect if test encounters a deadlock. We need to decide how to test for timeouts as cargo test doesn't seem to support this out of the box.
TODO: this test uses
scriptwhich is part ofutil-linuxand thus not available on MacOS. Need to restrict this test just to linux or find a way to simulate terminal on MacOS.