Skip to content

Commit cfed89a

Browse files
committed
Ported distributed-process-extras
1 parent ecec015 commit cfed89a

File tree

7 files changed

+34
-75
lines changed

7 files changed

+34
-75
lines changed

packages/distributed-process-extras/distributed-process-extras.cabal

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,20 @@ common warnings
3131
-Wredundant-constraints
3232
-fhide-source-paths
3333
-Wpartial-fields
34+
-Wunused-packages
3435

3536
library
3637
import: warnings
3738
build-depends: base >= 4.14 && < 5,
3839
distributed-process >= 0.6.0 && < 0.8,
3940
binary >= 0.8 && < 0.9,
4041
deepseq >= 1.4 && < 1.7,
41-
mtl >= 2.0 && < 2.4,
4242
containers >= 0.6 && < 0.8,
4343
exceptions >= 0.10,
4444
hashable >= 1.2.0.5 && < 1.6,
4545
unordered-containers >= 0.2.3.0 && < 0.3,
4646
fingertree < 0.2,
4747
stm >= 2.4 && < 2.6,
48-
transformers >= 0.2 && < 0.7,
4948
time >= 1.5
5049
other-extensions: ExistentialQuantification
5150
HS-Source-Dirs: src
@@ -72,16 +71,10 @@ test-suite InternalQueueTests
7271
x-uses-tf: true
7372
build-depends:
7473
base >= 4.14 && < 5,
75-
ansi-terminal >= 0.5 && < 1.2,
76-
distributed-process >= 0.6.0 && < 0.8,
7774
distributed-process-extras,
78-
distributed-process-systest ^>= 0.4,
79-
HUnit >= 1.2 && < 2,
80-
test-framework >= 0.6 && < 0.9,
81-
test-framework-hunit,
82-
QuickCheck >= 2.4,
83-
test-framework-quickcheck2,
84-
ghc-prim
75+
tasty >= 1.5 && <1.6,
76+
tasty-hunit >=0.10 && <0.11,
77+
tasty-quickcheck >=0.11 && <0.12
8578
hs-source-dirs: tests
8679
ghc-options: -rtsopts
8780
main-is: TestQueues.hs
@@ -94,22 +87,13 @@ test-suite PrimitivesTests
9487
x-uses-tf: true
9588
build-depends:
9689
base >= 4.14 && < 5,
97-
ansi-terminal >= 0.5 && < 1.2,
9890
distributed-process >= 0.6.0 && < 0.8,
9991
distributed-process-extras,
10092
distributed-process-systest ^>= 0.4,
10193
network-transport >= 0.4 && < 0.6,
102-
mtl,
103-
containers,
10494
network-transport-tcp >= 0.4 && < 0.9,
105-
binary >= 0.8 && < 0.9,
106-
deepseq,
107-
network >= 2.3 && < 3.3,
108-
HUnit >= 1.2 && < 2,
109-
stm,
110-
test-framework >= 0.6 && < 0.9,
111-
test-framework-hunit,
112-
transformers
95+
tasty >= 1.5 && <1.6,
96+
tasty-hunit >=0.10 && <0.11,
11397
hs-source-dirs: tests
11498
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
11599
main-is: TestPrimitives.hs
@@ -121,19 +105,14 @@ test-suite TimerTests
121105
x-uses-tf: true
122106
build-depends:
123107
base >= 4.14 && < 5,
124-
ansi-terminal >= 0.5 && < 1.2,
125108
deepseq,
126109
distributed-process >= 0.6.0 && < 0.8,
127110
distributed-process-extras,
128111
distributed-process-systest ^>= 0.4,
129112
network-transport >= 0.4 && < 0.6,
130113
network-transport-tcp >= 0.4 && < 0.9,
131-
HUnit >= 1.2 && < 2,
132-
test-framework >= 0.6 && < 0.9,
133-
test-framework-hunit,
134-
QuickCheck >= 2.4,
135-
test-framework-quickcheck2,
136-
ghc-prim
114+
tasty >= 1.5 && <1.6,
115+
tasty-hunit >=0.10 && <0.11,
137116
hs-source-dirs: tests
138117
ghc-options: -rtsopts
139118
main-is: TestTimer.hs
@@ -146,30 +125,14 @@ test-suite LoggerTests
146125
-- x-uses-tf: true
147126
build-depends:
148127
base >= 4.14 && < 5,
149-
ansi-terminal >= 0.5 && < 1.2,
150-
containers,
151-
hashable,
152-
unordered-containers >= 0.2.3.0 && < 0.3,
153128
distributed-process >= 0.6.0 && < 0.8,
154129
distributed-process-extras,
155130
distributed-process-systest ^>= 0.4,
156-
distributed-static,
157-
bytestring,
158-
data-accessor,
159-
fingertree < 0.2,
160131
network-transport >= 0.4 && < 0.6,
161-
deepseq,
162-
mtl,
163132
network-transport-tcp >= 0.4 && < 0.9,
164-
binary >= 0.8 && < 0.9,
165-
network >= 2.3 && < 3.3,
166-
HUnit >= 1.2 && < 2,
167133
stm,
168-
time > 1.4 && < 1.15,
169-
test-framework >= 0.6 && < 0.9,
170-
test-framework-hunit,
171-
transformers,
172-
ghc-prim
134+
tasty >= 1.5 && <1.6,
135+
tasty-hunit >=0.10 && <0.11,
173136
hs-source-dirs: tests
174137
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
175138
main-is: TestLog.hs

packages/distributed-process-extras/tests/TestLog.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import Data.List (delete)
2121

2222
import Prelude hiding (drop, read, Read)
2323

24-
import Test.Framework (Test, testGroup, defaultMain)
25-
import Test.Framework.Providers.HUnit (testCase)
24+
import Test.Tasty (TestTree, testGroup, defaultMain)
25+
import Test.Tasty.HUnit (testCase)
2626
import Network.Transport.TCP
2727
import qualified Network.Transport as NT
2828

@@ -98,7 +98,7 @@ testHarness levels chan result = do
9898
lift P.skipSpaces
9999
return x
100100

101-
tests :: NT.Transport -> IO [Test]
101+
tests :: NT.Transport -> IO TestTree
102102
tests transport = do
103103
let ch = logChannel
104104
localNode <- newLocalNode transport $ __remoteTable initRemoteTable
@@ -107,7 +107,7 @@ tests transport = do
107107
void $ forkProcess localNode $ do (_, chan) <- testLoggingProcess
108108
liftIO $ putMVar ex chan
109109
chan <- takeMVar ex
110-
return [
110+
return $ testGroup "TestLog" [
111111
testGroup "Log Reports / LogText"
112112
(map (mkTestCase lock chan ch simpleShowToLog localNode) (enumFromTo Debug Emergency))
113113
, testGroup "Logging Raw Messages"
@@ -126,7 +126,7 @@ tests transport = do
126126
messageRaw = unsafeWrapMessage
127127

128128
-- | Given a @builder@ function, make and run a test suite on a single transport
129-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
129+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
130130
testMain builder = do
131131
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
132132
testData <- builder transport

packages/distributed-process-extras/tests/TestPrimitives.hs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import Control.Distributed.Process.Extras.Time
1818
import Control.Monad (void)
1919
import Network.Transport.TCP()
2020

21-
import Test.HUnit (Assertion, assertEqual, assertBool)
22-
import Test.Framework (Test, testGroup, defaultMain)
23-
import Test.Framework.Providers.HUnit (testCase)
21+
import Test.Tasty (TestTree, testGroup, defaultMain)
22+
import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase)
2423
import Network.Transport.TCP
2524
import qualified Network.Transport as NT
2625
import Control.Distributed.Process.SysTest.Utils
@@ -178,8 +177,8 @@ multicallTest transport =
178177
-- Utilities and Plumbing --
179178
--------------------------------------------------------------------------------
180179

181-
tests :: NT.Transport -> LocalNode -> [Test]
182-
tests transport localNode = [
180+
tests :: NT.Transport -> LocalNode -> TestTree
181+
tests transport localNode = testGroup "TestPrimitives" [
183182
testGroup "Linking Tests" [
184183
testCase "testLinkingWithNormalExits"
185184
(delayedAssertion
@@ -202,14 +201,14 @@ tests transport localNode = [
202201
-- ]
203202
]
204203

205-
primitivesTests :: NT.Transport -> IO [Test]
204+
primitivesTests :: NT.Transport -> IO TestTree
206205
primitivesTests transport = do
207206
localNode <- newLocalNode transport initRemoteTable
208207
let testData = tests transport localNode
209208
return testData
210209

211210
-- | Given a @builder@ function, make and run a test suite on a single transport
212-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
211+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
213212
testMain builder = do
214213
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
215214
testData <- builder transport

packages/distributed-process-extras/tests/TestQueues.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import qualified Control.Distributed.Process.Extras.Internal.Queue.PriorityQ as
88

99
import Data.Function (on)
1010
import Data.List ( sortBy )
11-
import Test.Framework as TF (defaultMain, testGroup, Test)
12-
import Test.Framework.Providers.HUnit
13-
import Test.Framework.Providers.QuickCheck2 (testProperty)
14-
import Test.HUnit (assertBool, assertEqual)
11+
import Test.Tasty (TestTree, testGroup, defaultMain)
12+
import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase)
13+
import Test.Tasty.QuickCheck (testProperty)
1514

1615
import Prelude
1716

@@ -50,8 +49,8 @@ prop_enqueue_empty s =
5049
Just (_, q') = FIFO.dequeue q
5150
in (FIFO.isEmpty q') == ((FIFO.isEmpty q) == False)
5251

53-
tests :: [TF.Test]
54-
tests = [
52+
tests :: TestTree
53+
tests = testGroup "TestQueues" [
5554
testGroup "Priority Queue Tests" [
5655
-- testCase "New Queue Should Be Empty"
5756
-- (expect (PQ.isEmpty $ PQ.empty) $ equalTo True),

packages/distributed-process-extras/tests/TestTimer.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import Control.Distributed.Process.Extras.Time
1818
import Control.Distributed.Process.Extras.Timer
1919
import Control.Distributed.Process.SysTest.Utils
2020

21-
import Test.Framework (Test, testGroup, defaultMain)
22-
import Test.Framework.Providers.HUnit (testCase)
21+
import Test.Tasty (TestTree, testGroup, defaultMain)
22+
import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase)
2323
import Network.Transport.TCP
2424
import qualified Network.Transport as NT
2525

@@ -139,8 +139,8 @@ testSleep r = do
139139
-- Utilities and Plumbing --
140140
--------------------------------------------------------------------------------
141141

142-
tests :: LocalNode -> [Test]
143-
tests localNode = [
142+
tests :: LocalNode -> TestTree
143+
tests localNode = testGroup "TestTimer" [
144144
testGroup "Timer Tests" [
145145
testCase "testSendAfter"
146146
(delayedAssertion
@@ -173,14 +173,14 @@ tests localNode = [
173173
]
174174
]
175175

176-
timerTests :: NT.Transport -> IO [Test]
176+
timerTests :: NT.Transport -> IO TestTree
177177
timerTests transport = do
178178
localNode <- newLocalNode transport initRemoteTable
179179
let testData = tests localNode
180180
return testData
181181

182182
-- | Given a @builder@ function, make and run a test suite on a single transport
183-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
183+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
184184
testMain builder = do
185185
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
186186
testData <- builder transport

packages/distributed-process-tests/tests/runInMemory.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ main = do
1919
-- Tests are time sensitive. Running the tests concurrently can slow them
2020
-- down enough that threads using threadDelay would wake up later than
2121
-- expected, thus changing the order in which messages were expected.
22-
-- Therefore we run the tests sequentially by passing "-j 1" to
23-
-- test-framework. This does not solve the issue but makes it less likely.
22+
-- Therefore we run the tests sequentially
2423
--
2524
-- The problem was first detected with
2625
-- 'Control.Distributed.Process.Tests.CH.testMergeChannels'

packages/distributed-process-tests/tests/runTCP.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ main = do
3737
-- Tests are time sensitive. Running the tests concurrently can slow them
3838
-- down enough that threads using threadDelay would wake up later than
3939
-- expected, thus changing the order in which messages were expected.
40-
-- Therefore we run the tests sequentially by passing "-j 1" to
41-
-- test-framework. This does not solve the issue but makes it less likely.
40+
-- Therefore we run the tests sequentially
4241
--
4342
-- The problem was first detected with
4443
-- 'Control.Distributed.Process.Tests.CH.testMergeChannels'

0 commit comments

Comments
 (0)