@@ -15,7 +15,7 @@ import Control.Concurrent.MVar
15 , takeMVar
15 , takeMVar
16 , readMVar
16 , readMVar
18−import Control.Monad (replicateM_, replicateM, forever)
18+import Control.Monad (replicateM_, replicateM, forever, void)
19import Control.Exception (SomeException, throwIO)
19import Control.Exception (SomeException, throwIO)
20import qualified Control.Exception as Ex (catch)
20import qualified Control.Exception as Ex (catch)
21import Control.Applicative ((<$>), (<*>), pure, (<|>))
21import Control.Applicative ((<$>), (<*>), pure, (<|>))
@@ -39,6 +39,8 @@ import Control.Distributed.Process.Serializable (Serializable)
39import Test.HUnit (Assertion)
39import Test.HUnit (Assertion)
40import Test.Framework (Test, defaultMain, testGroup)
40import Test.Framework (Test, defaultMain, testGroup)
41import Test.Framework.Providers.HUnit (testCase)
41import Test.Framework.Providers.HUnit (testCase)
42+import Control.Rematch hiding (expect, match)
43+import qualified Control.Rematch as Rematch (expect)
43newtype Ping = Ping ProcessId
45newtype Ping = Ping ProcessId
44 deriving (Typeable, Binary, Show)
46 deriving (Typeable, Binary, Show)
@@ -1074,6 +1076,20 @@ testCatches transport = do
1075 takeMVar done
1077 takeMVar done
1079+testMaskRestoreScope :: NT.Transport -> Assertion
1080+testMaskRestoreScope transport = do
1081+ localNode <- newLocalNode transport initRemoteTable
1082+ parentPid <- newEmptyMVar :: IO (MVar ProcessId)
1083+ spawnedPid <- newEmptyMVar :: IO (MVar ProcessId)
1085+ void $ runProcess localNode $ mask $ \unmask -> do
1086+ getSelfPid >>= liftIO . putMVar parentPid
1087+ void $ spawnLocal $ unmask (getSelfPid >>= liftIO . putMVar spawnedPid)
1089+ parent <- liftIO $ takeMVar parentPid
1090+ child <- liftIO $ takeMVar spawnedPid
1091+ Rematch.expect parent $ isNot $ equalTo child
1077testDie :: NT.Transport -> Assertion
1093testDie :: NT.Transport -> Assertion
1078testDie transport = do
1094testDie transport = do
1079 localNode <- newLocalNode transport initRemoteTable
1095 localNode <- newLocalNode transport initRemoteTable
@@ -1178,6 +1194,7 @@ tests (transport, transportInternals) = [
1178 , testCase "PrettyExit" (testPrettyExit transport)
1194 , testCase "PrettyExit" (testPrettyExit transport)
1179 , testCase "CatchesExit" (testCatchesExit transport)
1195 , testCase "CatchesExit" (testCatchesExit transport)
1180 , testCase "Catches" (testCatches transport)
1196 , testCase "Catches" (testCatches transport)
1197+ , testCase "MaskRestoreScope" (testMaskRestoreScope transport)
1181 , testCase "ExitLocal" (testExitLocal transport)
1198 , testCase "ExitLocal" (testExitLocal transport)
1182 , testCase "ExitRemote" (testExitRemote transport)
1199 , testCase "ExitRemote" (testExitRemote transport)