Skip to content

Commit

Permalink
Merge pull request #372 from haskell-distributed/warnings-9.4.5
Browse files Browse the repository at this point in the history
Warnings 9.4.5
  • Loading branch information
davidsd committed Jul 8, 2023
2 parents 92c97ac + 61939a4 commit db7a033
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 97 deletions.
24 changes: 12 additions & 12 deletions distributed-process-tests/distributed-process-tests.cabal
Expand Up @@ -25,7 +25,7 @@ library
Control.Distributed.Process.Tests.Stats
Control.Distributed.Process.Tests.Tracing
Control.Distributed.Process.Tests.Internal.Utils
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
ansi-terminal >= 0.5,
binary >= 0.5 && < 0.9,
bytestring >= 0.9 && < 0.12,
Expand Down Expand Up @@ -59,22 +59,22 @@ Test-Suite TestCHInMemory
Type: exitcode-stdio-1.0
Main-Is: runInMemory.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.CH
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.3 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
network-transport-inmemory >= 0.5,
test-framework >= 0.6 && < 0.9
Extensions: CPP
ghc-options: -Wall -threaded -eventlog -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
HS-Source-Dirs: tests

Test-Suite TestCHInTCP
Type: exitcode-stdio-1.0
Main-Is: runTCP.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.CH
if flag(tcp)
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.5 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
Expand All @@ -83,15 +83,15 @@ Test-Suite TestCHInTCP
else
Buildable: False
Extensions: CPP
ghc-options: -Wall -threaded -eventlog -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
HS-Source-Dirs: tests


Test-Suite TestClosure
Type: exitcode-stdio-1.0
Main-Is: runInMemory.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Closure
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.3 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
Expand All @@ -105,21 +105,21 @@ Test-Suite TestStats
Type: exitcode-stdio-1.0
Main-Is: runInMemory.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Stats
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.3 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
network-transport-inmemory >= 0.5,
test-framework >= 0.6 && < 0.9
Extensions: CPP
ghc-options: -Wall -eventlog -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
HS-Source-Dirs: tests

Test-Suite TestMxInMemory
Type: exitcode-stdio-1.0
Main-Is: runInMemory.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Mx
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.3 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
Expand All @@ -133,21 +133,21 @@ Test-Suite TestTracingInMemory
Type: exitcode-stdio-1.0
Main-Is: runInMemory.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Tracing
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.3 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
network-transport-inmemory >= 0.5,
test-framework >= 0.6 && < 0.9
Extensions: CPP
ghc-options: -eventlog -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
HS-Source-Dirs: tests

Test-Suite TestMxInTCP
Type: exitcode-stdio-1.0
Main-Is: runInMemory.hs
CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Mx
Build-Depends: base >= 4.4 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process-tests,
network >= 2.3 && < 3.2,
network-transport >= 0.4.1.0 && < 0.6,
Expand Down
Expand Up @@ -42,9 +42,7 @@ import Control.Distributed.Process.Internal.Types
, createUnencodedMessage
)
import Control.Distributed.Process.Node
import Control.Distributed.Process.Debug
import Control.Distributed.Process.Management.Internal.Types
import Control.Distributed.Process.Tests.Internal.Utils (shouldBe, pause)
import Control.Distributed.Process.Tests.Internal.Utils (pause)
import Control.Distributed.Process.Serializable (Serializable)
import Data.Maybe (isNothing, isJust)
import Test.HUnit (Assertion, assertBool, assertFailure)
Expand Down Expand Up @@ -102,14 +100,6 @@ whereisRemote nid string = do
verifyWhereIsRemote :: NodeId -> String -> Process ProcessId
verifyWhereIsRemote n s = whereisRemote n s >>= maybe (die "remote name not found") return

waitForExit :: ProcessId -> Process DiedReason
waitForExit pid = monitor pid >>= waitForDown

waitForDown :: MonitorRef -> Process DiedReason
waitForDown ref =
receiveWait [ matchIf (\(ProcessMonitorNotification ref' _ _) -> ref == ref')
(\(ProcessMonitorNotification _ _ dr) -> return dr) ]

syncBreakConnection :: (NT.EndPointAddress -> NT.EndPointAddress -> IO ()) -> LocalNode -> LocalNode -> IO ()
syncBreakConnection breakConnection nid0 nid1 = do
m <- newEmptyMVar
Expand Down Expand Up @@ -706,9 +696,9 @@ testRegistry TestTransport{..} = do
checkRegException name pid dead =
try (register name dead) >>= checkReg name pid

checkReg name pid res =
checkReg _ _ res =
case res of
Left (ProcessRegistrationException name pid) -> return ()
Left (ProcessRegistrationException _ _) -> return ()
_ -> die $ "Unexpected Registration" ++ show res

testRegistryRemoteProcess :: TestTransport -> Assertion
Expand Down Expand Up @@ -759,7 +749,7 @@ testRemoteRegistry TestTransport{..} = do
-- test that if process was not registered Nothing is returned
-- in owner field.
registerRemoteAsync nid1 "dead" deadProcess
receiveWait [ matchIf (\(RegisterReply label' f mPid) -> "dead" == label')
receiveWait [ matchIf (\(RegisterReply label' _ _) -> "dead" == label')
(\(RegisterReply _ f mPid) -> return (not f && isNothing mPid))
] >>= liftIO . assertBool "Expected False Nothing in RegisterReply"

Expand Down Expand Up @@ -1296,7 +1286,7 @@ testChanLifecycle TestTransport{..} = let delay = 3000000 in do
res <- receiveChanTimeout delay rp
case res of
Nothing -> say "initial chan () missing!" >> (liftIO $ putMVar result False)
Just () -> do mr <- monitor pid
Just () -> do _ <- monitor pid
pause 10000
-- say "sending pid a second () will cause it to exit"
send pid ()
Expand Down Expand Up @@ -1571,7 +1561,7 @@ testRegistryMonitoring TestTransport{..} = do
res <- whereis regName
send pid ()
say $ " sent finish signal to " ++ show pid
us <- getSelfPid
_ <- getSelfPid
liftIO $ assertBool "expected (Just pid)" $ res == (Just pid)


Expand Down Expand Up @@ -1600,7 +1590,7 @@ testRegistryMonitoring TestTransport{..} = do
res <- takeMVar regHere
case res of
Nothing -> return ()
Just pid -> assertBool ("expected Nothing, but got " ++ show pid) False
_ -> assertBool ("expected Nothing, but got " ++ show pid) False

where
runUntilRegistered nid us = do
Expand All @@ -1613,7 +1603,7 @@ testRegistryMonitoring TestTransport{..} = do
delayUntilMaybeUnregistered nid p = do
whereisRemoteAsync nid regName
res <- receiveTimeout 20000000 {- 20 sec delay -} [
matchIf (\(WhereIsReply n p) -> n == regName && isNothing p)
matchIf (\(WhereIsReply n p') -> n == regName && isNothing p')
(const $ return ())
]
case res of
Expand Down
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
{-# LANGUAGE TemplateHaskell, KindSignatures #-}
module Control.Distributed.Process.Tests.Closure (tests) where

Expand All @@ -19,14 +20,12 @@ import Control.Concurrent.MVar
, modifyMVar_
, newMVar
)
import Control.Applicative ((<$>))
import System.Random (randomIO)
import Control.Distributed.Process
import Control.Distributed.Process.Closure
import Control.Distributed.Process.Node
import Control.Distributed.Process.Internal.Types
( NodeId(nodeAddress)
, createMessage
( createMessage
, messageToPayload
)
import Control.Distributed.Static (staticLabel, staticClosure)
Expand Down
Expand Up @@ -101,44 +101,44 @@ master = do
kill p "BANG"

liftIO $ putStrLn "\n---- Test 2 ----"
(s1,r1) <- newChan
(s2,r2) <- newChan
p <- spawnLocal (recTest2 waitr syncs r1 r2)

sendChan s1 "a" >> go "received1 a"
send p "foo" >> go "received2 foo"
sendChan s1 "a" >> send p "foo" >> go "received1 a"
sendChan s1 "a" >> send p "bar" >> go "received1 a"
(s1',r1') <- newChan
(_ ,r2') <- newChan
p' <- spawnLocal (recTest2 waitr syncs r1' r2')

sendChan s1' "a" >> go "received1 a"
send p' "foo" >> go "received2 foo"
sendChan s1' "a" >> send p "foo" >> go "received1 a"
sendChan s1' "a" >> send p "bar" >> go "received1 a"
go "received2 foo"

kill p "BANG"
kill p' "BANG"

liftIO $ putStrLn "\n---- Test 3 ----"
(s1,r1) <- newChan
(s2,r2) <- newChan
p <- spawnLocal (recTest3 waitr syncs r1 r2)

sendChan s1 "a" >> go "received2 a"
send p "foo" >> go "received1 foo"
sendChan s1 "a" >> send p "foo" >> go "received1 foo"
sendChan s1 "a" >> send p "bar" >> go "received2 a"
(s1'',r1'') <- newChan
(_ ,r2'') <- newChan
p'' <- spawnLocal (recTest3 waitr syncs r1'' r2'')

sendChan s1'' "a" >> go "received2 a"
send p'' "foo" >> go "received1 foo"
sendChan s1'' "a" >> send p "foo" >> go "received1 foo"
sendChan s1'' "a" >> send p "bar" >> go "received2 a"
go "received2 a"

kill p "BANG"
kill p'' "BANG"

liftIO $ putStrLn "\n---- Test 4 ----"
(s1,r1) <- newChan
(s2,r2) <- newChan
p <- spawnLocal (recTest4 waitr syncs r1 r2)

sendChan s1 "a" >> go "received2 a"
send p "foo" >> go "received1 foo"
send p "bar" >> go "received3 bar"
sendChan s1 "a" >> send p "foo" >> go "received1 foo"
send p "bar" >> go "received2 a"
send p "foo" >> go "received1 foo" >> go "received3 bar"

kill p "BANG"
(s1''',r1''') <- newChan
(_ ,r2''') <- newChan
p''' <- spawnLocal (recTest4 waitr syncs r1''' r2''')

sendChan s1''' "a" >> go "received2 a"
send p''' "foo" >> go "received1 foo"
send p''' "bar" >> go "received3 bar"
sendChan s1''' "a" >> send p''' "foo" >> go "received1 foo"
send p''' "bar" >> go "received2 a"
send p''' "foo" >> go "received1 foo" >> go "received3 bar"

kill p''' "BANG"

terminate

Expand Down
12 changes: 6 additions & 6 deletions distributed-process.cabal
Expand Up @@ -41,7 +41,7 @@ flag old-locale
default: False

Library
Build-Depends: base >= 4.6 && < 5,
Build-Depends: base >= 4.9 && < 5,
binary >= 0.6.3 && < 0.10,
hashable >= 1.2.0.5 && <= 1.4.2.0,
network-transport >= 0.4.1.0 && < 0.6,
Expand Down Expand Up @@ -119,7 +119,7 @@ Library

benchmark distributed-process-throughput
Type: exitcode-stdio-1.0
Build-Depends: base >= 4.6 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process,
network-transport-tcp >= 0.3 && <= 0.81,
bytestring >= 0.9 && <= 0.12,
Expand All @@ -129,7 +129,7 @@ benchmark distributed-process-throughput

benchmark distributed-process-latency
Type: exitcode-stdio-1.0
Build-Depends: base >= 4.6 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process,
network-transport-tcp >= 0.3 && <= 0.81,
bytestring >= 0.9 && <= 0.12,
Expand All @@ -139,7 +139,7 @@ benchmark distributed-process-latency

benchmark distributed-process-channels
Type: exitcode-stdio-1.0
Build-Depends: base >= 4.6 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process,
network-transport-tcp >= 0.3 && <= 0.81,
bytestring >= 0.9 && <= 0.12,
Expand All @@ -149,7 +149,7 @@ benchmark distributed-process-channels

benchmark distributed-process-spawns
Type: exitcode-stdio-1.0
Build-Depends: base >= 4.6 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process,
network-transport-tcp >= 0.3 && <= 0.81,
bytestring >= 0.9 && <= 0.12,
Expand All @@ -159,7 +159,7 @@ benchmark distributed-process-spawns

benchmark distributed-process-ring
Type: exitcode-stdio-1.0
Build-Depends: base >= 4.6 && < 5,
Build-Depends: base >= 4.9 && < 5,
distributed-process,
network-transport-tcp >= 0.3 && <= 0.81,
bytestring >= 0.9 && <= 0.12,
Expand Down
2 changes: 0 additions & 2 deletions src/Control/Distributed/Process/Internal/CQueue.hs
Expand Up @@ -31,7 +31,6 @@ import Control.Concurrent.STM
, orElse
, retry
)
import Control.Applicative ((<$>), (<*>))
import Control.Exception (mask_, onException)
import System.Timeout (timeout)
import Control.Distributed.Process.Internal.StrictMVar
Expand All @@ -45,7 +44,6 @@ import Control.Distributed.Process.Internal.StrictList
, append
)
import Data.Maybe (fromJust)
import Data.Traversable (traverse)
import GHC.MVar (MVar(MVar))
import GHC.IO (IO(IO), unIO)
import GHC.Exts (mkWeak#)
Expand Down
4 changes: 3 additions & 1 deletion src/Control/Distributed/Process/Internal/Closure/Explicit.hs
Expand Up @@ -7,6 +7,7 @@
, KindSignatures
, GADTs
, EmptyDataDecls
, TypeOperators
, DeriveDataTypeable #-}
module Control.Distributed.Process.Internal.Closure.Explicit
(
Expand All @@ -29,6 +30,7 @@ import Data.Rank1Dynamic
import Data.Rank1Typeable
import Data.Binary(encode,put,get,Binary)
import qualified Data.ByteString.Lazy as B
import Data.Kind (Type)

-- | A RemoteRegister is a trasformer on a RemoteTable to register additional static values.
type RemoteRegister = RemoteTable -> RemoteTable
Expand Down Expand Up @@ -118,7 +120,7 @@ instance Curry (b -> c) r => Curry ((a,b) -> c) (a -> r) where
-- This generic uncurry courtesy Andrea Vezzosi
data HTrue
data HFalse
data Fun :: * -> * -> * -> * where
data Fun :: Type -> Type -> Type -> Type where
Done :: Fun EndOfTuple r r
Moar :: Fun xs f r -> Fun (x,xs) (x -> f) r

Expand Down
1 change: 0 additions & 1 deletion src/Control/Distributed/Process/Internal/Closure/TH.hs
Expand Up @@ -12,7 +12,6 @@ module Control.Distributed.Process.Internal.Closure.TH
) where

import Prelude hiding (succ, any)
import Control.Applicative ((<$>))
import Language.Haskell.TH
( -- Q monad and operations
Q
Expand Down

0 comments on commit db7a033

Please sign in to comment.