@@ -838,6 +838,70 @@ testReceiveChanFeatures transport = do
839 takeMVar done
839 takeMVar done
841+testKillLocal :: NT.Transport -> Assertion
842+testKillLocal transport = do
843+ localNode <- newLocalNode transport initRemoteTable
845+ pid <- forkProcess localNode $ do
846+ liftIO $ threadDelay 100000
848+ runProcess localNode $ do
851+ ProcessMonitorNotification ref' pid' (DiedException ex) <- expect
852+ True <- return $ ref == ref' && pid == pid' && ex == "TestKill"
855+testKillRemote :: NT.Transport -> Assertion
856+testKillRemote transport = do
857+ node1 <- newLocalNode transport initRemoteTable
858+ node2 <- newLocalNode transport initRemoteTable
860+ pid <- forkProcess node1 $ do
861+ liftIO $ threadDelay 100000
863+ runProcess node2 $ do
866+ ProcessMonitorNotification ref' pid' (DiedException ex) <- expect
867+ True <- return $ ref == ref' && pid == pid' && ex == "TestKill"
870+testExitLocal :: NT.Transport -> Assertion
871+testExitLocal transport = do
872+ localNode <- newLocalNode transport initRemoteTable
874+ pid <- forkProcess localNode $ do
875+ (liftIO $ threadDelay 100000)
876+ `catchExit` \from reason -> do
877+ say $ "Got " ++ reason ++ " from " ++ show from
880+ runProcess localNode $ do
883+ ProcessMonitorNotification ref' pid' (DiedException ex) <- expect
884+ True <- return $ ref == ref' && pid == pid' && ex == "TestExit"
887+testExitRemote :: NT.Transport -> Assertion
888+testExitRemote transport = do
889+ node1 <- newLocalNode transport initRemoteTable
890+ node2 <- newLocalNode transport initRemoteTable
892+ pid <- forkProcess node1 $ do
893+ (liftIO $ threadDelay 100000)
894+ `catchExit` \from reason -> do
895+ say $ "Got " ++ reason ++ " from " ++ show from
898+ runProcess node2 $ do
901+ ProcessMonitorNotification ref' pid' (DiedException ex) <- expect
902+ True <- return $ ref == ref' && pid == pid' && ex == "TestExit"
841tests :: (NT.Transport, TransportInternals) -> [Test]
905tests :: (NT.Transport, TransportInternals) -> [Test]
842tests (transport, transportInternals) = [
906tests (transport, transportInternals) = [
843 testGroup "Basic features" [
907 testGroup "Basic features" [
@@ -855,6 +919,10 @@ tests (transport, transportInternals) = [
855 , testCase "MatchAny" (testMatchAny transport)
919 , testCase "MatchAny" (testMatchAny transport)
856 , testCase "ReceiveChanTimeout" (testReceiveChanTimeout transport)
920 , testCase "ReceiveChanTimeout" (testReceiveChanTimeout transport)
857 , testCase "ReceiveChanFeatures" (testReceiveChanFeatures transport)
921 , testCase "ReceiveChanFeatures" (testReceiveChanFeatures transport)
922+ , testCase "KillLocal" (testKillLocal transport)
923+ , testCase "KillRemote" (testKillRemote transport)
924+ , testCase "ExitLocal" (testExitLocal transport)
925+ , testCase "ExitRemote" (testExitRemote transport)
859 , testGroup "Monitoring and Linking" [
927 , testGroup "Monitoring and Linking" [
860 -- Monitoring processes
928 -- Monitoring processes