These are a couple of regression tests for GHC bug #10317. See the discussion on D849.
These must be built with ghc -threaded
and should be run with the included
shell scripts.
This test verifies that multiple registrations against the same fd fire as
expected. The Haskell test opens an AF_INET
socket and registers read and
write event registrations. The shell script is listening on this socket and
writes to it after a delay. Consequently, the write registration should trigger
immediately upon connection and the read registration should fire after the
delay.
$ ./test-multiple-reg.sh
write callback
("hello",5)
$ ./test-multiple-reg.sh
write callback
TestMultipleReg: thread blocked indefinitely in an MVar operation
This test verifies that MultiShot
registrations indeed fire multiple
times. The Haskell test opens a fifo filled with data by the shell script. We
then register a multi-shot read event against this fd and in the callback
perform several short reads. The callback should be called several times.
$ ./test-multishot.sh
ok
$ ./test-multishot.sh
TestMultishot: thread blocked indefinitely in an MVar operation