@@ -50,6 +50,7 @@ import Test.Framework
5050 ( Test
5151 , testGroup
5252 )
53+import Test.HUnit (Assertion)
5354import Test.Framework.Providers.HUnit (testCase)
5455
5556data Publish = Publish
@@ -329,9 +330,8 @@ ensure = flip finally
329330
330331testNSend :: (String -> () -> Process ())
331332 -> Maybe LocalNode
332− -> TestResult Bool
333333 -> Process ()
334−testNSend op n r = testMxSend n r $ \p1 sink -> do
334+testNSend op n = testMxSend n $ \p1 sink -> do
335335 let delay = 5000000
336336 let label = "testMxSend"
337337 let isValid = isValidLabel n label
@@ -360,9 +360,8 @@ testNSend op n r = testMxSend n r $ \p1 sink -> do
360360
361361testSend :: (ProcessId -> () -> Process ())
362362 -> Maybe LocalNode
363− -> TestResult Bool
364363 -> Process ()
365−testSend op n r = testMxSend n r $ \p1 sink -> do
364+testSend op n = testMxSend n $ \p1 sink -> do
366365 -- initiate a send
367366 op p1 ()
368367
@@ -376,9 +375,8 @@ testSend op n r = testMxSend n r $ \p1 sink -> do
376375
377376testChan :: (SendPort () -> () -> Process ())
378377 -> Maybe LocalNode
379− -> TestResult Bool
380378 -> Process ()
381−testChan op n r = testMxSend n r $ \p1 sink -> do
379+testChan op n = testMxSend n $ \p1 sink -> do
382380
383381 us <- getSelfPid
384382 send p1 us
@@ -404,8 +402,8 @@ testChan op n r = testMxSend n r $ \p1 sink -> do
404402
405403type SendTest = ProcessId -> ReceivePort MxEvent -> Process Bool
406404
407−testMxSend :: Maybe LocalNode -> TestResult Bool -> SendTest -> Process ()
408−testMxSend mNode result test = do
405+testMxSend :: Maybe LocalNode -> SendTest -> Process ()
406+testMxSend mNode test = do
409407 us <- getSelfPid
410408 (sp, rp) <- newChan
411409 (chan, sink) <- newChan
@@ -431,12 +429,15 @@ testMxSend mNode result test = do
431429
432430 p1 <- receiveChan rp
433431 res <- try (test p1 sink)
434− case res of
435− Left (ProcessExitException _ m) -> (liftIO $ putStrLn $ "SomeException-" ++ show m) >> stash result False
436− Right tr -> stash result tr
432+
437433 kill agent "bye"
438434 kill p1 "bye"
439435
436+ case res of
437+ Left (ProcessExitException _ m) -> (liftIO $ putStrLn $ "SomeException-" ++ show m) >> die m
438+ Right tr -> tr `shouldBe` equalTo True
439+
440+
440441 where
441442 label = "testMxSend"
442443 agentLabel s = "mx-unsafe-check-agent-" ++ show s
@@ -452,7 +453,7 @@ testMxSend mNode result test = do
452453 return r
453454
454455tests :: TestTransport -> IO [Test]
455−tests TestTransport{..} = do
456+tests tt@TestTransport{..} = do
456457 node1 <- newLocalNode testTransport initRemoteTable
457458 node2 <- newLocalNode testTransport initRemoteTable
458459 return [
@@ -489,12 +490,11 @@ tests TestTransport{..} = do
489490 (delayedAssertion
490491 "expected process deaths to result in unregistration events"
491492 node1 () (testMxRegMon node2))
492− , testGroup "SendEvents" $ buildTestCases node1 node2
493+ , testGroup "SendEvents" $ buildTestCases tt node2
493494 ]
494495 ]
495496 where
496− buildTestCases n1 n2 =
497− let nid = localNodeId n2 in build n2 [
497+ buildTestCases tt' n2 = let nid = localNodeId n2 in build tt' n2 [
498498 ("NSend", [
499499 ("nsend", testNSend nsend)
500500 , ("Unsafe.nsend", testNSend Unsafe.nsend)
@@ -515,14 +515,15 @@ tests TestTransport{..} = do
515515 ])
516516 ]
517517
518− build :: LocalNode
519− -> [(String, [(String, (Maybe LocalNode -> TestResult Bool -> Process ()))])]
518+ build :: TestTransport
519+ -> LocalNode
520+ -> [(String, [(String, (Maybe LocalNode -> Process ()))])]
520521 -> [Test]
521− build ln specs =
522+ build TestTransport{..} ln specs =
522523 [ testGroup (intercalate "-" [groupName, caseSuffix]) [
523524 testCase (intercalate "-" [caseName, caseSuffix])
524− (delayedAssertion "expected mx events failed"
525− ln True (caseImpl caseNode))
525+ (newLocalNode testTransport initRemoteTable >>= \n ->
526+ tryRunProcess n (caseImpl caseNode))
526527 | (caseName, caseImpl) <- groupCases
527528 ]
528529 | (groupName, groupCases) <- specs