git.iko.soy/distributed-process
on master help sign in
2 files changed+18−13
since splitsnapshots
unifiedsplit
distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs+18−10 untilfail−3
distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs+18−10
@@ -1556,20 +1556,24 @@ testRegistryMonitoring :: TestTransport -> Assertion
15561556testRegistryMonitoring TestTransport{..} = do
15571557 node1 <- newLocalNode testTransport initRemoteTable
15581558 node2 <- newLocalNode testTransport initRemoteTable
1559− waitH <- newEmptyMVar
15601559
15611560 let nid = localNodeId node2
15621561 pid <- forkProcess node1 $ do
1563− getSelfPid >>= runUntilRegistered nid
1564− liftIO $ takeMVar waitH
1562+ self <- getSelfPid
1563+ runUntilRegistered nid self
1564+ say $ (show self) ++ " registered as " ++ regName
1565+ expect :: Process ()
1566+ say $ (show self) ++ " exiting normally"
15651567
15661568 runProcess node2 $ do
15671569 register regName pid
1570+ say $ regName ++ " registered to " ++ show pid
15681571 res <- whereis regName
1572+ send pid ()
1573+ say $ " sent finish signal to " ++ show pid
15691574 us <- getSelfPid
1570− liftIO $ do
1571− putMVar waitH ()
1572− assertBool "expected (Just pid)" $ res == (Just pid)
1575+ liftIO $ assertBool "expected (Just pid)" $ res == (Just pid)
1576+
15731577
15741578 -- This delay isn't essential!
15751579 -- The test case passes perfectly fine without it (feel free to comment out
@@ -1594,7 +1598,9 @@ testRegistryMonitoring TestTransport{..} = do
15941598 regHere <- newEmptyMVar
15951599 runProcess node2 $ whereis regName >>= liftIO . putMVar regHere
15961600 res <- takeMVar regHere
1597− assertBool "expected Nothing, but process still registered" (res == Nothing)
1601+ case res of
1602+ Nothing -> return ()
1603+ Just pid -> assertBool ("expected Nothing, but got " ++ show pid) False
15981604
15991605 where
16001606 runUntilRegistered nid us = do
@@ -1606,11 +1612,13 @@ testRegistryMonitoring TestTransport{..} = do
16061612
16071613 delayUntilMaybeUnregistered nid p = do
16081614 whereisRemoteAsync nid regName
1609− receiveTimeout 20000000 {- 20 sec delay -} [
1610− matchIf (\(WhereIsReply n p) -> n == regName && p == Nothing)
1615+ res <- receiveTimeout 20000000 {- 20 sec delay -} [
1616+ matchIf (\(WhereIsReply n p) -> n == regName && isNothing p)
16111617 (const $ return ())
16121618 ]
1613− return ()
1619+ case res of
1620+ Just () -> return ()
1621+ Nothing -> delayUntilMaybeUnregistered nid p
16141622
16151623 regName = "testRegisterRemote"
16161624
untilfaildeleted−3
@@ -1,3 +0,0 @@
1−#!/bin/bash
2−
3−while $@; do :; done