Commit 7d3af7b8 authored by Kamil's avatar Kamil Committed by Kamil
Browse files

Add a regression test for #17912

parent 3d328eb5
Pipeline #41107 passed with stages
in 572 minutes and 10 seconds
{-# Language ScopedTypeVariables #-}
module Main where
import Control.Concurrent
import Control.Exception
import System.IO
import System.Exit
import System.Process
import GHC.IO.Handle.FD
main = do
ecode <- waitForProcess =<< spawnProcess "mkfifo" ["fifo"]
case ecode of
ExitFailure code -> putStrLn "mkfifo failed"
ExitSuccess -> do
passed <- newEmptyMVar
opener <- forkIO $
(openFileBlocking "fifo" WriteMode >> return ())
`catch` \(e:: AsyncException) -> do
if e == ThreadKilled then do
putStrLn "openFileBlocking successfully interrupted"
putMVar passed True
else print e
throwIO e
threadDelay 1000
forkIO $ killThread opener
forkIO $ do
threadDelay (10^6)
putStrLn "timeout!"
putMVar passed False
res <- readMVar passed
case res of
True -> exitSuccess
False -> exitFailure
openFileBlocking successfully interrupted
......@@ -149,3 +149,4 @@ test('T17414',
compile_and_run, [''])
test('T17510', expect_broken(17510), compile_and_run, [''])
test('bytestringread001', extra_run_opts('test.data'), compile_and_run, [''])
test('T17912', [only_ways(['threaded1']), when(opsys('mingw32'),expect_broken(1))], compile_and_run, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment