git.iko.soy/distributed-process
on ba4d0a4 help sign in
2 files changed+13−18
since splitsnapshots
unifiedsplit
distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs+10−18 untilfail+3
distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs+10−18
@@ -1556,24 +1556,20 @@ testRegistryMonitoring :: TestTransport -> Assertion
15561556testRegistryMonitoring TestTransport{..} = do
15571557 node1 <- newLocalNode testTransport initRemoteTable
15581558 node2 <- newLocalNode testTransport initRemoteTable
1559+ waitH <- newEmptyMVar
15591560
15601561 let nid = localNodeId node2
15611562 pid <- forkProcess node1 $ do
1562− self <- getSelfPid
1563− runUntilRegistered nid self
1564− say $ (show self) ++ " registered as " ++ regName
1565− expect :: Process ()
1566− say $ (show self) ++ " exiting normally"
1563+ getSelfPid >>= runUntilRegistered nid
1564+ liftIO $ takeMVar waitH
15671565
15681566 runProcess node2 $ do
15691567 register regName pid
1570− say $ regName ++ " registered to " ++ show pid
15711568 res <- whereis regName
1572− send pid ()
1573− say $ " sent finish signal to " ++ show pid
15741569 us <- getSelfPid
1575− liftIO $ assertBool "expected (Just pid)" $ res == (Just pid)
1576−
1570+ liftIO $ do
1571+ putMVar waitH ()
1572+ assertBool "expected (Just pid)" $ res == (Just pid)
15771573
15781574 -- This delay isn't essential!
15791575 -- The test case passes perfectly fine without it (feel free to comment out
@@ -1598,9 +1594,7 @@ testRegistryMonitoring TestTransport{..} = do
15981594 regHere <- newEmptyMVar
15991595 runProcess node2 $ whereis regName >>= liftIO . putMVar regHere
16001596 res <- takeMVar regHere
1601− case res of
1602− Nothing -> return ()
1603− Just pid -> assertBool ("expected Nothing, but got " ++ show pid) False
1597+ assertBool "expected Nothing, but process still registered" (res == Nothing)
16041598
16051599 where
16061600 runUntilRegistered nid us = do
@@ -1612,13 +1606,11 @@ testRegistryMonitoring TestTransport{..} = do
16121606
16131607 delayUntilMaybeUnregistered nid p = do
16141608 whereisRemoteAsync nid regName
1615− res <- receiveTimeout 20000000 {- 20 sec delay -} [
1616− matchIf (\(WhereIsReply n p) -> n == regName && isNothing p)
1609+ receiveTimeout 20000000 {- 20 sec delay -} [
1610+ matchIf (\(WhereIsReply n p) -> n == regName && p == Nothing)
16171611 (const $ return ())
16181612 ]
1619− case res of
1620− Just () -> return ()
1621− Nothing -> delayUntilMaybeUnregistered nid p
1613+ return ()
16221614
16231615 regName = "testRegisterRemote"
16241616
untilfailnew file+3
@@ -0,0 +1,3 @@
1+#!/bin/bash
2+
3+while $@; do :; done