Rodrigo Mesquita pushed to branch wip/romes/multi-threaded-debugger at Glasgow Haskell Compiler / GHC Commits: 15b5c741 by Rodrigo Mesquita at 2026-10-22T11:16:56+01:00 test: make T3171 not fragile and add version for ext interp too - actually test the sleep of the user-given expression gets interrupted - the ext interp version tests two things: - Requests can be cancelled without terminating the ext interp (#18852) - The stmt being evaluated gets interrupted in the ext interp (that is, ^C gets sent to the thread running the user-given expression and doesn't affect the ext interp main thread) - testing ext interp requires sending ^C to whole process group Fixes #15383 - - - - - 4 changed files: - testsuite/tests/ghci/should_run/Makefile - testsuite/tests/ghci/should_run/T3171.stdout - + testsuite/tests/ghci/should_run/T3171ext.stdout - testsuite/tests/ghci/should_run/all.T Changes: ===================================== testsuite/tests/ghci/should_run/Makefile ===================================== @@ -3,10 +3,20 @@ include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk # Test that threadDelay can be interrupted by ^C. -T3171: - echo "do Control.Concurrent.threadDelay 3000000; putStrLn \"threadDelay was not interrupted\"" | \ - "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) & \ - sleep 2; kill -INT $$!; wait +# Wait for the statement to start before interrupting (#15383), and signal +# the external interpreter too (the `pgrep -P $!`), as ^C in a terminal would. +# +# The ext interp tests both: +# - interrupting a remote request doesn't terminate the ext interpreter (#18852) +# - a ^C gets propagated to the thread evaluating the user request on the ext +# interpreter so that it gets interrupted +T3171ext: T3171_OPTS = -fexternal-interpreter +T3171 T3171ext: + rm -f $@.started + echo 'do { writeFile "$@.started" ""; Control.Concurrent.threadDelay 100000000 `Control.Exception.onException` System.IO.hPutStrLn System.IO.stderr "threadDelay was interrupted"; putStrLn "threadDelay was not interrupted" }' | \ + "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) $(T3171_OPTS) & \ + while [ ! -e $@.started ] && kill -0 $$! 2>/dev/null; do sleep 0.1; done; \ + kill -INT $$! $$(pgrep -P $$!); wait TopEnvIface: "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) TopEnvIface -v1 -fno-hide-source-paths -e "a" -e ":q" -fwrite-if-simplified-core -fwrite-interface ===================================== testsuite/tests/ghci/should_run/T3171.stdout ===================================== @@ -1 +1,2 @@ +threadDelay was interrupted Interrupted. ===================================== testsuite/tests/ghci/should_run/T3171ext.stdout ===================================== @@ -0,0 +1,2 @@ +threadDelay was interrupted +Interrupted. ===================================== testsuite/tests/ghci/should_run/all.T ===================================== @@ -12,11 +12,17 @@ test('T27287', [just_ghci, combined_output], makefile_test, []) test('T3171', [when(opsys('mingw32'),skip), - fragile(15383), req_interp, combined_output], makefile_test, []) +test('T3171ext', + [when(opsys('mingw32'),skip), + req_interp, + unless(config.have_ext_interp, skip), + combined_output], + makefile_test, []) + test('ghcirun004', just_ghci, compile_and_run, ['']) test('T8377', just_ghci, compile_and_run, ['']) test('T9914', just_ghci, ghci_script, ['T9914.script']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/15b5c741ba3bbca8db53d0db9c3df799... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/15b5c741ba3bbca8db53d0db9c3df799... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help