Test that SIGINT interrupts non-terminating goals on unix.

Cleanup: use tokio::test instead of special test helpers

Added pty_exec.py helper script to run binaries with a pseudoterminal attached (bug won't trigger otherwise).

Tested CI to fail on all unixes (ubuntu+macos) with older rustyline, and pass with new one.
This commit is contained in:
Danil Platonov
2026-05-30 11:45:57 -07:00
parent 8b6d68a4cd
commit 39c850b4f4
5 changed files with 69 additions and 40 deletions

View File

@@ -1,7 +1,5 @@
use crate::helper::load_module_test;
use crate::helper::load_module_test_with_input;
#[cfg(all(feature = "http", not(target_arch = "wasm32")))]
use crate::helper::load_module_test_with_tokio_runtime_and_input;
use serial_test::serial;
// issue #831
@@ -163,13 +161,25 @@ fn issue3262_read_from_stdin_no_newline() {
load_module_test_with_input("tests-pl/issue3262.pl", "hello.", "hello");
}
#[test]
#[tokio::test(flavor = "multi_thread")]
#[cfg(all(feature = "http", not(target_arch = "wasm32")))]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn http_open_hanging() {
load_module_test_with_tokio_runtime_and_input(
async fn http_open_hanging() {
load_module_test_with_input(
"tests-pl/issue-http_open-hanging.pl",
format!("PROLOG={:?}.", env!("CARGO_BIN_EXE_scryer-prolog")),
"received response with status code:200\nreceived response with status code:200\nreceived response with status code:200\nreceived response with status code:200\nreceived response with status code:200\n"
);
}
#[tokio::test(flavor = "multi_thread")]
#[cfg(feature = "repl")]
#[cfg(unix)]
#[cfg_attr(miri, ignore = "it takes too long to run")]
async fn sigint_interrupts_nonterminating_goals() {
load_module_test_with_input(
"tests-pl/issue-interrupt-nontermination.pl",
format!("PROLOG={:?}.", env!("CARGO_BIN_EXE_scryer-prolog")),
"ok\n",
);
}