diff --git a/packages/distributed-process-async/CHANGELOG.md b/packages/distributed-process-async/CHANGELOG.md index b623f4a7..6eea56eb 100644 --- a/packages/distributed-process-async/CHANGELOG.md +++ b/packages/distributed-process-async/CHANGELOG.md @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-10-30 David Simmons-Duffin 0.2.10 * Bump dependency bound for ansi-terminal diff --git a/packages/distributed-process-async/distributed-process-async.cabal b/packages/distributed-process-async/distributed-process-async.cabal index 19671082..13b65d5e 100644 --- a/packages/distributed-process-async/distributed-process-async.cabal +++ b/packages/distributed-process-async/distributed-process-async.cabal @@ -32,6 +32,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings @@ -75,13 +76,11 @@ test-suite AsyncTests network-transport-tcp >= 0.6 && < 0.9, binary >= 0.8 && < 0.9, deepseq >= 1.4 && < 1.7, - -- HUnit >= 1.2 && < 2, stm >= 2.3 && < 2.6, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, transformers - hs-source-dirs: - tests + hs-source-dirs: tests default-language: Haskell2010 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind default-extensions: CPP diff --git a/packages/distributed-process-async/tests/TestAsync.hs b/packages/distributed-process-async/tests/TestAsync.hs index a620c8d9..411f434c 100644 --- a/packages/distributed-process-async/tests/TestAsync.hs +++ b/packages/distributed-process-async/tests/TestAsync.hs @@ -17,8 +17,8 @@ import Data.Typeable() import Network.Transport.TCP import qualified Network.Transport as NT -import Test.Framework (Test, testGroup, defaultMain) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty(TestTree, testGroup, defaultMain) +import Test.Tasty.HUnit (testCase) testAsyncPoll :: TestResult (AsyncResult ()) -> Process () testAsyncPoll result = do @@ -158,8 +158,8 @@ testAsyncRecursive result = do myNode <- getSelfNode fib (myNode,6) >>= stash result -tests :: LocalNode -> [Test] -tests localNode = [ +tests :: LocalNode -> TestTree +tests localNode = testGroup "" [ testGroup "Handling async results with STM" [ testCase "testAsyncCancel" (delayedAssertion @@ -210,14 +210,14 @@ tests localNode = [ ] ] -asyncStmTests :: NT.Transport -> IO [Test] +asyncStmTests :: NT.Transport -> IO TestTree asyncStmTests transport = do localNode <- newLocalNode transport $ __remoteTableDecl initRemoteTable let testData = tests localNode return testData -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-client-server/CHANGELOG.md b/packages/distributed-process-client-server/CHANGELOG.md index 645f71e3..190c24ca 100644 --- a/packages/distributed-process-client-server/CHANGELOG.md +++ b/packages/distributed-process-client-server/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-10-30 David Simmons-Duffin 0.2.7.1 * Bump dependency bound for ansi-terminal diff --git a/packages/distributed-process-client-server/distributed-process-client-server.cabal b/packages/distributed-process-client-server/distributed-process-client-server.cabal index bf7781fc..49f5e775 100644 --- a/packages/distributed-process-client-server/distributed-process-client-server.cabal +++ b/packages/distributed-process-client-server/distributed-process-client-server.cabal @@ -33,6 +33,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings @@ -87,10 +88,9 @@ test-suite ManagedProcessTests binary >= 0.8 && < 0.9, deepseq, network >= 2.3 && < 3.3, - HUnit >= 1.2 && < 2, stm, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, transformers, ghc-prim, exceptions @@ -125,10 +125,9 @@ test-suite PrioritisedProcessTests binary, deepseq, network, - HUnit, stm, - test-framework, - test-framework-hunit, + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, transformers, ghc-prim, exceptions diff --git a/packages/distributed-process-client-server/tests/TestManagedProcess.hs b/packages/distributed-process-client-server/tests/TestManagedProcess.hs index 45b2dbd1..f5be4931 100644 --- a/packages/distributed-process-client-server/tests/TestManagedProcess.hs +++ b/packages/distributed-process-client-server/tests/TestManagedProcess.hs @@ -26,8 +26,8 @@ import MathsDemo import Counter import qualified SafeCounter as SafeCounter -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (testCase) import TestUtils import ManagedProcessCommon @@ -210,13 +210,14 @@ testCounterExceedsLimit result = do ] stash result (r /= DiedNormal) -tests :: NT.Transport -> IO [Test] +tests :: NT.Transport -> IO TestTree tests transport = do localNode <- newLocalNode transport initRemoteTable scpid <- newEmptyMVar _ <- forkProcess localNode $ SafeCounter.startCounter 5 >>= stash scpid safeCounter <- takeMVar scpid - return [ + return $ + testGroup "" [ testGroup "Basic Client/Server Functionality" [ testCase "basic call with explicit server reply" (delayedAssertion diff --git a/packages/distributed-process-client-server/tests/TestPrioritisedProcess.hs b/packages/distributed-process-client-server/tests/TestPrioritisedProcess.hs index 8116249e..4ff110dd 100644 --- a/packages/distributed-process-client-server/tests/TestPrioritisedProcess.hs +++ b/packages/distributed-process-client-server/tests/TestPrioritisedProcess.hs @@ -38,8 +38,8 @@ import Data.List (isInfixOf) import Data.Maybe (isNothing, isJust) import Data.Typeable (Typeable) -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (testCase) import TestUtils import ManagedProcessCommon @@ -534,10 +534,10 @@ testCallPrioritisation result = do let ms = rights st stash result $ ms == ["we do prioritise", "the longest", "commands", "first"] -tests :: NT.Transport -> IO [Test] +tests :: NT.Transport -> IO TestTree tests transport = do localNode <- newLocalNode transport initRemoteTable - return [ + return $ testGroup "" [ testGroup "basic server functionality matches un-prioritised processes" [ testCase "basic call with explicit server reply" (delayedAssertion diff --git a/packages/distributed-process-client-server/tests/TestUtils.hs b/packages/distributed-process-client-server/tests/TestUtils.hs index a6ac5116..b976cc9f 100644 --- a/packages/distributed-process-client-server/tests/TestUtils.hs +++ b/packages/distributed-process-client-server/tests/TestUtils.hs @@ -18,7 +18,7 @@ import Control.Distributed.Process.Node import Control.Distributed.Process.Extras import Control.Distributed.Process.Extras.Time import Control.Distributed.Process.Extras.Timer -import Test.Framework (Test, defaultMain) +import Test.Tasty (TestTree, defaultMain) import Network.Transport.TCP import qualified Network.Transport as NT @@ -41,7 +41,7 @@ mkNode port = do newLocalNode transport1 initRemoteTable -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-execution/ChangeLog b/packages/distributed-process-execution/ChangeLog index 3cd57bbe..d2d91b4e 100644 --- a/packages/distributed-process-execution/ChangeLog +++ b/packages/distributed-process-execution/ChangeLog @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-10-30 David Simmons-Duffin 0.1.4.1 * Bump dependency bound for ansi-terminal diff --git a/packages/distributed-process-execution/distributed-process-execution.cabal b/packages/distributed-process-execution/distributed-process-execution.cabal index 5fef0777..f4c77e55 100644 --- a/packages/distributed-process-execution/distributed-process-execution.cabal +++ b/packages/distributed-process-execution/distributed-process-execution.cabal @@ -33,6 +33,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings @@ -45,14 +46,10 @@ library distributed-process-client-server >= 0.2.0 && < 0.3, binary >= 0.8 && < 0.9, deepseq >= 1.4 && < 1.7, - mtl, containers >= 0.6 && < 0.8, hashable >= 1.2.0.5 && < 1.6, unordered-containers >= 0.2.3.0 && < 0.3, - fingertree < 0.2, stm >= 2.4 && < 2.6, - time, - transformers hs-source-dirs: src exposed-modules: Control.Distributed.Process.Execution, @@ -69,38 +66,16 @@ library test-suite ExchangeTests import: warnings type: exitcode-stdio-1.0 --- x-uses-tf: true - build-depends: - base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, - containers, - hashable, - unordered-containers >= 0.2.3.0 && < 0.3, + build-depends: base >= 4.14 && < 5, distributed-process, distributed-process-execution, distributed-process-extras, distributed-process-systest ^>= 0.4, - distributed-static, - bytestring, - data-accessor, - fingertree < 0.2, network-transport >= 0.4 && < 0.6, - deepseq, - mtl, network-transport-tcp >= 0.4 && < 0.9, - binary >= 0.8 && < 0.9, - network >= 2.3 && < 3.3, - HUnit >= 1.2 && < 2, - stm, - time, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, - QuickCheck >= 2.4, - test-framework-quickcheck2, - transformers, - ghc-prim - hs-source-dirs: - tests + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, + hs-source-dirs: tests ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind main-is: TestExchange.hs default-language: Haskell2010 @@ -109,38 +84,16 @@ test-suite ExchangeTests test-suite MailboxTests import: warnings type: exitcode-stdio-1.0 --- x-uses-tf: true - build-depends: - base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, - containers, - hashable, - unordered-containers >= 0.2.3.0 && < 0.3, + build-depends: base >= 4.14 && < 5, distributed-process, distributed-process-execution, distributed-process-extras, distributed-process-systest ^>= 0.4, - distributed-static, - bytestring, - data-accessor, - fingertree < 0.2, network-transport >= 0.4 && < 0.6, - deepseq, - mtl, network-transport-tcp >= 0.4 && < 0.9, - binary >= 0.8 && < 0.9, - network >= 2.3 && < 3.3, - HUnit >= 1.2 && < 2, - stm, - time, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, - QuickCheck >= 2.4, - test-framework-quickcheck2, - transformers, - ghc-prim - hs-source-dirs: - tests + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, + hs-source-dirs: tests ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind main-is: TestMailbox.hs other-modules: MailboxTestFilters diff --git a/packages/distributed-process-execution/tests/TestExchange.hs b/packages/distributed-process-execution/tests/TestExchange.hs index 6ccae812..9357d81f 100644 --- a/packages/distributed-process-execution/tests/TestExchange.hs +++ b/packages/distributed-process-execution/tests/TestExchange.hs @@ -22,9 +22,8 @@ import Control.Monad (void, forM, forever) import Prelude hiding (drop) import Network.Transport.TCP import qualified Network.Transport as NT -import Test.Framework as TF (defaultMain, testGroup, Test) -import Test.Framework.Providers.HUnit -import Test.HUnit (assertEqual, assertBool) +import Test.Tasty (defaultMain, testGroup, TestTree) +import Test.Tasty.HUnit (assertEqual, assertBool, testCase) testKeyBasedRouting :: TestResult Bool -> Process () testKeyBasedRouting result = do @@ -158,10 +157,10 @@ myRemoteTable :: RemoteTable myRemoteTable = Control.Distributed.Process.Extras.__remoteTable initRemoteTable -tests :: NT.Transport -> IO [Test] +tests :: NT.Transport -> IO TestTree tests transport = do localNode <- newLocalNode transport myRemoteTable - return [ + return $ testGroup "" [ testGroup "Event Manager" [ testCase "Simple Event Handlers" @@ -187,7 +186,7 @@ main :: IO () main = testMain $ tests -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "10501") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-execution/tests/TestMailbox.hs b/packages/distributed-process-execution/tests/TestMailbox.hs index 392585d4..b5f1400e 100644 --- a/packages/distributed-process-execution/tests/TestMailbox.hs +++ b/packages/distributed-process-execution/tests/TestMailbox.hs @@ -17,9 +17,8 @@ import Prelude hiding (drop) import Data.Maybe (catMaybes) -import Test.Framework as TF (defaultMain, testGroup, Test) -import Test.Framework.Providers.HUnit -import Test.HUnit (assertEqual) +import Test.Tasty (defaultMain, testGroup, TestTree) +import Test.Tasty.HUnit (assertEqual, testCase) import qualified MailboxTestFilters (__remoteTable) import MailboxTestFilters (myFilter, intFilter) @@ -175,11 +174,11 @@ myRemoteTable = Control.Distributed.Process.Extras.__remoteTable $ MailboxTestFilters.__remoteTable initRemoteTable -tests :: NT.Transport -> IO [Test] +tests :: NT.Transport -> IO TestTree tests transport = do {- verboseCheckWithResult stdArgs -} localNode <- newLocalNode transport myRemoteTable - return [ + return $ testGroup "" [ testGroup "Dequeue/Pop Ordering" [ testCase "Queue Ordering" @@ -253,7 +252,7 @@ main :: IO () main = testMain $ tests -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "10501") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-extras/ChangeLog b/packages/distributed-process-extras/ChangeLog index 345c7562..868f92e6 100644 --- a/packages/distributed-process-extras/ChangeLog +++ b/packages/distributed-process-extras/ChangeLog @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-10-30 David Simmons-Duffin 0.3.8 * Bump dependency bound for ansi-terminal diff --git a/packages/distributed-process-extras/distributed-process-extras.cabal b/packages/distributed-process-extras/distributed-process-extras.cabal index f5289ae8..c6f62780 100644 --- a/packages/distributed-process-extras/distributed-process-extras.cabal +++ b/packages/distributed-process-extras/distributed-process-extras.cabal @@ -31,6 +31,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings @@ -38,14 +39,12 @@ library distributed-process >= 0.6.0 && < 0.8, binary >= 0.8 && < 0.9, deepseq >= 1.4 && < 1.7, - mtl >= 2.0 && < 2.4, containers >= 0.6 && < 0.8, exceptions >= 0.10, hashable >= 1.2.0.5 && < 1.6, unordered-containers >= 0.2.3.0 && < 0.3, fingertree < 0.2, stm >= 2.4 && < 2.6, - transformers >= 0.2 && < 0.7, time >= 1.5 other-extensions: ExistentialQuantification HS-Source-Dirs: src @@ -72,16 +71,10 @@ test-suite InternalQueueTests x-uses-tf: true build-depends: base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, - distributed-process >= 0.6.0 && < 0.8, distributed-process-extras, - distributed-process-systest ^>= 0.4, - HUnit >= 1.2 && < 2, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, - QuickCheck >= 2.4, - test-framework-quickcheck2, - ghc-prim + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, + tasty-quickcheck >=0.11 && <0.12 hs-source-dirs: tests ghc-options: -rtsopts main-is: TestQueues.hs @@ -94,22 +87,13 @@ test-suite PrimitivesTests x-uses-tf: true build-depends: base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, distributed-process >= 0.6.0 && < 0.8, distributed-process-extras, distributed-process-systest ^>= 0.4, network-transport >= 0.4 && < 0.6, - mtl, - containers, network-transport-tcp >= 0.4 && < 0.9, - binary >= 0.8 && < 0.9, - deepseq, - network >= 2.3 && < 3.3, - HUnit >= 1.2 && < 2, - stm, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, - transformers + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, hs-source-dirs: tests ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind main-is: TestPrimitives.hs @@ -121,19 +105,14 @@ test-suite TimerTests x-uses-tf: true build-depends: base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, deepseq, distributed-process >= 0.6.0 && < 0.8, distributed-process-extras, distributed-process-systest ^>= 0.4, network-transport >= 0.4 && < 0.6, network-transport-tcp >= 0.4 && < 0.9, - HUnit >= 1.2 && < 2, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, - QuickCheck >= 2.4, - test-framework-quickcheck2, - ghc-prim + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, hs-source-dirs: tests ghc-options: -rtsopts main-is: TestTimer.hs @@ -146,30 +125,14 @@ test-suite LoggerTests -- x-uses-tf: true build-depends: base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, - containers, - hashable, - unordered-containers >= 0.2.3.0 && < 0.3, distributed-process >= 0.6.0 && < 0.8, distributed-process-extras, distributed-process-systest ^>= 0.4, - distributed-static, - bytestring, - data-accessor, - fingertree < 0.2, network-transport >= 0.4 && < 0.6, - deepseq, - mtl, network-transport-tcp >= 0.4 && < 0.9, - binary >= 0.8 && < 0.9, - network >= 2.3 && < 3.3, - HUnit >= 1.2 && < 2, stm, - time > 1.4 && < 1.15, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, - transformers, - ghc-prim + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, hs-source-dirs: tests ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind main-is: TestLog.hs diff --git a/packages/distributed-process-extras/tests/TestLog.hs b/packages/distributed-process-extras/tests/TestLog.hs index 71df258a..1a0ee7a1 100644 --- a/packages/distributed-process-extras/tests/TestLog.hs +++ b/packages/distributed-process-extras/tests/TestLog.hs @@ -21,8 +21,8 @@ import Data.List (delete) import Prelude hiding (drop, read, Read) -import Test.Framework (Test, testGroup, defaultMain) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup, defaultMain) +import Test.Tasty.HUnit (testCase) import Network.Transport.TCP import qualified Network.Transport as NT @@ -98,7 +98,7 @@ testHarness levels chan result = do lift P.skipSpaces return x -tests :: NT.Transport -> IO [Test] +tests :: NT.Transport -> IO TestTree tests transport = do let ch = logChannel localNode <- newLocalNode transport $ __remoteTable initRemoteTable @@ -107,7 +107,7 @@ tests transport = do void $ forkProcess localNode $ do (_, chan) <- testLoggingProcess liftIO $ putMVar ex chan chan <- takeMVar ex - return [ + return $ testGroup "TestLog" [ testGroup "Log Reports / LogText" (map (mkTestCase lock chan ch simpleShowToLog localNode) (enumFromTo Debug Emergency)) , testGroup "Logging Raw Messages" @@ -126,7 +126,7 @@ tests transport = do messageRaw = unsafeWrapMessage -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-extras/tests/TestPrimitives.hs b/packages/distributed-process-extras/tests/TestPrimitives.hs index fba6c2b7..780f5477 100644 --- a/packages/distributed-process-extras/tests/TestPrimitives.hs +++ b/packages/distributed-process-extras/tests/TestPrimitives.hs @@ -18,9 +18,8 @@ import Control.Distributed.Process.Extras.Time import Control.Monad (void) import Network.Transport.TCP() -import Test.HUnit (Assertion, assertEqual, assertBool) -import Test.Framework (Test, testGroup, defaultMain) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup, defaultMain) +import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase) import Network.Transport.TCP import qualified Network.Transport as NT import Control.Distributed.Process.SysTest.Utils @@ -178,8 +177,8 @@ multicallTest transport = -- Utilities and Plumbing -- -------------------------------------------------------------------------------- -tests :: NT.Transport -> LocalNode -> [Test] -tests transport localNode = [ +tests :: NT.Transport -> LocalNode -> TestTree +tests transport localNode = testGroup "TestPrimitives" [ testGroup "Linking Tests" [ testCase "testLinkingWithNormalExits" (delayedAssertion @@ -202,14 +201,14 @@ tests transport localNode = [ -- ] ] -primitivesTests :: NT.Transport -> IO [Test] +primitivesTests :: NT.Transport -> IO TestTree primitivesTests transport = do localNode <- newLocalNode transport initRemoteTable let testData = tests transport localNode return testData -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-extras/tests/TestQueues.hs b/packages/distributed-process-extras/tests/TestQueues.hs index 655035c4..4624232e 100644 --- a/packages/distributed-process-extras/tests/TestQueues.hs +++ b/packages/distributed-process-extras/tests/TestQueues.hs @@ -8,10 +8,9 @@ import qualified Control.Distributed.Process.Extras.Internal.Queue.PriorityQ as import Data.Function (on) import Data.List ( sortBy ) -import Test.Framework as TF (defaultMain, testGroup, Test) -import Test.Framework.Providers.HUnit -import Test.Framework.Providers.QuickCheck2 (testProperty) -import Test.HUnit (assertBool, assertEqual) +import Test.Tasty (TestTree, testGroup, defaultMain) +import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase) +import Test.Tasty.QuickCheck (testProperty) import Prelude @@ -50,8 +49,8 @@ prop_enqueue_empty s = Just (_, q') = FIFO.dequeue q in (FIFO.isEmpty q') == ((FIFO.isEmpty q) == False) -tests :: [TF.Test] -tests = [ +tests :: TestTree +tests = testGroup "TestQueues" [ testGroup "Priority Queue Tests" [ -- testCase "New Queue Should Be Empty" -- (expect (PQ.isEmpty $ PQ.empty) $ equalTo True), diff --git a/packages/distributed-process-extras/tests/TestTimer.hs b/packages/distributed-process-extras/tests/TestTimer.hs index 4be9b7d2..378c697c 100644 --- a/packages/distributed-process-extras/tests/TestTimer.hs +++ b/packages/distributed-process-extras/tests/TestTimer.hs @@ -18,8 +18,8 @@ import Control.Distributed.Process.Extras.Time import Control.Distributed.Process.Extras.Timer import Control.Distributed.Process.SysTest.Utils -import Test.Framework (Test, testGroup, defaultMain) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup, defaultMain) +import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase) import Network.Transport.TCP import qualified Network.Transport as NT @@ -139,8 +139,8 @@ testSleep r = do -- Utilities and Plumbing -- -------------------------------------------------------------------------------- -tests :: LocalNode -> [Test] -tests localNode = [ +tests :: LocalNode -> TestTree +tests localNode = testGroup "TestTimer" [ testGroup "Timer Tests" [ testCase "testSendAfter" (delayedAssertion @@ -173,14 +173,14 @@ tests localNode = [ ] ] -timerTests :: NT.Transport -> IO [Test] +timerTests :: NT.Transport -> IO TestTree timerTests transport = do localNode <- newLocalNode transport initRemoteTable let testData = tests localNode return testData -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-simplelocalnet/distributed-process-simplelocalnet.cabal b/packages/distributed-process-simplelocalnet/distributed-process-simplelocalnet.cabal index 7818857c..589a1c79 100644 --- a/packages/distributed-process-simplelocalnet/distributed-process-simplelocalnet.cabal +++ b/packages/distributed-process-simplelocalnet/distributed-process-simplelocalnet.cabal @@ -33,6 +33,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages Library import: warnings diff --git a/packages/distributed-process-supervisor/ChangeLog b/packages/distributed-process-supervisor/ChangeLog index 0e81d7a7..e3862220 100644 --- a/packages/distributed-process-supervisor/ChangeLog +++ b/packages/distributed-process-supervisor/ChangeLog @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-09-03 Laurent P. René de Cotret 0.2.2 * Bumped dependency bounds to support GHC 8.10.7 - GHC 9.10.1 diff --git a/packages/distributed-process-supervisor/distributed-process-supervisor.cabal b/packages/distributed-process-supervisor/distributed-process-supervisor.cabal index 0ebf500a..fe1d0d6f 100644 --- a/packages/distributed-process-supervisor/distributed-process-supervisor.cabal +++ b/packages/distributed-process-supervisor/distributed-process-supervisor.cabal @@ -37,6 +37,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings @@ -78,10 +79,9 @@ test-suite SupervisorTests network-transport-tcp >= 0.4 && < 0.9, binary >= 0.8 && < 0.9, deepseq, - HUnit >= 1.2 && < 2, stm, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, exceptions >= 0.10 && < 0.11 hs-source-dirs: tests ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-name-shadowing -fno-warn-unused-do-bind @@ -106,10 +106,9 @@ test-suite NonThreadedSupervisorTests network-transport-tcp >= 0.4 && < 0.9, binary >= 0.8 && < 0.9, deepseq, - HUnit >= 1.2 && < 2, stm, - test-framework >= 0.6 && < 0.9, - test-framework-hunit, + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, exceptions >= 0.10 && < 0.11 hs-source-dirs: tests ghc-options: -rtsopts -fno-warn-unused-do-bind -fno-warn-name-shadowing diff --git a/packages/distributed-process-supervisor/tests/TestSupervisor.hs b/packages/distributed-process-supervisor/tests/TestSupervisor.hs index 16d345a7..fa5e2432 100644 --- a/packages/distributed-process-supervisor/tests/TestSupervisor.hs +++ b/packages/distributed-process-supervisor/tests/TestSupervisor.hs @@ -51,9 +51,8 @@ import Control.Monad.Catch (finally) import Data.ByteString.Lazy (empty) import Data.Maybe (catMaybes, isNothing, isJust) -import Test.HUnit (Assertion, assertFailure, assertEqual, assertBool) -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, assertFailure, assertEqual, assertBool, testCase) import TestUtils hiding (waitForExit) import qualified Network.Transport as NT @@ -1198,7 +1197,7 @@ withClosure' fn clj ctx = do cs <- toChildStart clj fn cs ctx -tests :: NT.Transport -> IO [Test] +tests :: NT.Transport -> IO TestTree tests transport = do putStrLn $ concat [ "NOTICE: Branch Tests (Relying on Non-Guaranteed Message Order) " , "Can Fail Intermittently" ] @@ -1215,8 +1214,8 @@ tests transport = do let withSup' sm = runInTestContext' localNode sm let withSupervisor = runInTestContext localNode singleTestLock ParallelShutdown let withSupervisor' = runInTestContext' localNode ParallelShutdown - return - [ testGroup "Supervisor Processes" + return $ + testGroup "Supervisor Processes" [ testGroup "Starting And Adding Children" [ @@ -1449,14 +1448,6 @@ tests transport = do (delayedRestartAfterThreeAttempts withSupervisor') ] ] -{- , testGroup "CI" - [ testCase "Flush [NonTest]" - (withSupervisor' - (RestartRight defaultLimits (RestartInOrder LeftToRight)) [] - (\_ -> sleep $ seconds 20)) - ] --} - ] main :: IO () main = testMain $ tests diff --git a/packages/distributed-process-supervisor/tests/TestUtils.hs b/packages/distributed-process-supervisor/tests/TestUtils.hs index 519882e8..cd4eb352 100644 --- a/packages/distributed-process-supervisor/tests/TestUtils.hs +++ b/packages/distributed-process-supervisor/tests/TestUtils.hs @@ -60,9 +60,8 @@ import qualified Control.Exception as Exception import Control.Monad (forever) import Control.Monad.Catch (catch) import Control.Monad.STM (atomically) -import Test.HUnit (Assertion, assertEqual) -import Test.HUnit.Base (assertBool) -import Test.Framework (Test, defaultMain) +import Test.Tasty (TestTree, defaultMain) +import Test.Tasty.HUnit (Assertion, assertEqual, assertBool) import Control.DeepSeq import Network.Transport.TCP @@ -137,7 +136,7 @@ stopLogger :: Logger -> IO () stopLogger = (flip Exception.throwTo) Exception.ThreadKilled . _tid -- | Given a @builder@ function, make and run a test suite on a single transport -testMain :: (NT.Transport -> IO [Test]) -> IO () +testMain :: (NT.Transport -> IO TestTree) -> IO () testMain builder = do Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters testData <- builder transport diff --git a/packages/distributed-process-systest/ChangeLog b/packages/distributed-process-systest/ChangeLog index da472574..5b685709 100644 --- a/packages/distributed-process-systest/ChangeLog +++ b/packages/distributed-process-systest/ChangeLog @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-10-30 David Simmons-Duffin 0.4.1 * Bumped dependency bound for ansi-terminal diff --git a/packages/distributed-process-systest/distributed-process-systest.cabal b/packages/distributed-process-systest/distributed-process-systest.cabal index 58cc0c02..7ea7dd68 100644 --- a/packages/distributed-process-systest/distributed-process-systest.cabal +++ b/packages/distributed-process-systest/distributed-process-systest.cabal @@ -27,22 +27,15 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings exposed-modules: Control.Distributed.Process.SysTest.Utils Build-Depends: base >= 4.14 && < 5, - ansi-terminal >= 0.5 && < 1.2, binary >= 0.8 && < 1.0, - bytestring >= 0.10 && < 0.13, distributed-process >= 0.6.1 && < 0.8, - distributed-static < 0.4, HUnit >= 1.2 && < 2, - network-transport >= 0.4.1.0 && < 0.6, - network >= 2.5 && < 3.3, - random >= 1.0 && < 1.4, - test-framework >= 0.6 && < 0.9, - test-framework-hunit >= 0.2.0 && < 0.4, exceptions < 0.11, stm < 2.6 hs-source-dirs: src diff --git a/packages/distributed-process-tests/distributed-process-tests.cabal b/packages/distributed-process-tests/distributed-process-tests.cabal index 3c20ffb9..04e57305 100644 --- a/packages/distributed-process-tests/distributed-process-tests.cabal +++ b/packages/distributed-process-tests/distributed-process-tests.cabal @@ -30,6 +30,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings @@ -42,19 +43,16 @@ library Control.Distributed.Process.Tests.Tracing Control.Distributed.Process.Tests.Internal.Utils Build-Depends: base >= 4.14 && < 5, - ansi-terminal >= 0.5, binary >= 0.8 && < 0.9, bytestring >= 0.10 && < 0.13, distributed-process >= 0.6.0 && < 0.8, distributed-static, exceptions >= 0.10, - HUnit >= 1.2 && < 1.7, network-transport >= 0.4.1.0 && < 0.6, - network >= 2.5 && < 3.3, random >= 1.0 && < 1.4, setenv >= 0.1.1.3, - test-framework >= 0.6 && < 0.9, - test-framework-hunit >= 0.2.0 && < 0.4, + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, stm hs-source-dirs: src default-language: Haskell98 @@ -76,10 +74,8 @@ Test-Suite TestCHInMemory CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.CH Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.3 && < 3.3, - network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, default-extensions: CPP default-language: Haskell98 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind @@ -93,10 +89,9 @@ Test-Suite TestCHInTCP if flag(tcp) Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.5 && < 3.2, - network-transport >= 0.4.1.0 && < 0.6, + network >= 2.3 && < 3.3, network-transport-tcp >= 0.5 && < 0.9, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, else Buildable: False default-extensions: CPP @@ -112,10 +107,8 @@ Test-Suite TestClosure CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Closure Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.3 && < 3.3, - network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, default-extensions: CPP default-language: Haskell98 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind @@ -128,10 +121,8 @@ Test-Suite TestStats CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Stats Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.3 && < 3.3, - network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, default-extensions: CPP default-language: Haskell98 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind @@ -144,10 +135,8 @@ Test-Suite TestMxInMemory CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Mx Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.3 && < 3.3, - network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, default-extensions: CPP default-language: Haskell98 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind @@ -160,10 +149,8 @@ Test-Suite TestTracingInMemory CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Tracing Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.3 && < 3.3, - network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, default-extensions: CPP default-language: Haskell98 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind @@ -176,10 +163,8 @@ Test-Suite TestMxInTCP CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Mx Build-Depends: base >= 4.14 && < 5, distributed-process-tests, - network >= 2.3 && < 3.3, - network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, - test-framework >= 0.6 && < 0.9 + tasty >= 1.5 && <1.6, default-extensions: CPP default-language: Haskell98 ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs index e5f823c5..fe3417b8 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs @@ -42,9 +42,8 @@ import Control.Distributed.Process.Node import Control.Distributed.Process.Tests.Internal.Utils (pause) import Control.Distributed.Process.Serializable (Serializable) import Data.Maybe (isNothing, isJust) -import Test.HUnit (Assertion, assertBool, assertEqual, assertFailure) -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, assertBool, assertEqual, testCase) newtype Ping = Ping ProcessId deriving (Typeable, Binary, Show) @@ -1770,8 +1769,8 @@ testCallLocal TestTransport{..} = do takeMVar result4 >>= assertBool "Expected 'True'" -- XXX: Testing that when mask_ $ callLocal p runs p in masked state. -tests :: TestTransport -> IO [Test] -tests testtrans = return [ +tests :: TestTransport -> IO TestTree +tests testtrans = return $ testGroup "CH" [ testGroup "Basic features" [ testCase "Ping" (testPing testtrans) , testCase "Math" (testMath testtrans) diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Closure.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Closure.hs index f3f7dda1..96fdab77 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Closure.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Closure.hs @@ -31,9 +31,8 @@ import Control.Distributed.Process.Internal.Types import Control.Distributed.Static (staticLabel, staticClosure) import qualified Network.Transport as NT -import Test.HUnit (Assertion) -import Test.Framework (Test) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, testCase) -------------------------------------------------------------------------------- -- Supporting definitions -- @@ -563,10 +562,10 @@ testSpawnTerminate TestTransport{..} rtable = do takeMVar masterDone -tests :: TestTransport -> IO [Test] +tests :: TestTransport -> IO TestTree tests testtrans = do let rtable = __remoteTable . __remoteTableDecl $ initRemoteTable - return + return $ testGroup "Closure" [ testCase "Unclosure" (testUnclosure testtrans rtable) , testCase "Bind" (testBind testtrans rtable) , testCase "SendPureClosure" (testSendPureClosure testtrans rtable) diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Internal/Utils.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Internal/Utils.hs index 06aa71e9..f5d534b8 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Internal/Utils.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Internal/Utils.hs @@ -79,8 +79,7 @@ import Control.Monad.STM (atomically) import Data.Binary import Data.Typeable (Typeable) -import Test.HUnit (Assertion, assertFailure) -import Test.HUnit.Base (assertBool) +import Test.Tasty.HUnit (Assertion, assertBool) import GHC.Generics import System.Timeout (timeout) diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Mx.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Mx.hs index 816db02a..5b1dec37 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Mx.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Mx.hs @@ -41,12 +41,8 @@ import Data.Maybe (isJust, fromJust, isNothing, fromMaybe, catMaybes) import Data.Typeable import GHC.Generics hiding (from) -import Test.Framework - ( Test - , testGroup - ) -import Test.Framework.Providers.HUnit (testCase) -import Test.HUnit (assertBool, assertEqual) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (assertBool, assertEqual, testCase) data Publish = Publish deriving (Typeable, Generic, Eq) @@ -461,11 +457,11 @@ testMxSend mNode label test = do send p' s return r -tests :: TestTransport -> IO [Test] +tests :: TestTransport -> IO TestTree tests TestTransport{..} = do node1 <- newLocalNode testTransport initRemoteTable node2 <- newLocalNode testTransport initRemoteTable - return [ + return $ testGroup "Mx" [ testGroup "MxAgents" [ testCase "EventHandling" (delayedAssertion @@ -527,7 +523,7 @@ tests TestTransport{..} = do build :: LocalNode -> LocalNode -> [(String, [(String, (Maybe LocalNode -> Process ()))])] - -> [Test] + -> [TestTree] build n ln specs = [ testGroup (intercalate "-" [groupName, caseSuffix]) [ testCase (intercalate "-" [caseName, caseSuffix]) diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs index b58a1438..32cb12c8 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs @@ -14,9 +14,8 @@ import Control.Distributed.Process.Node import Control.Monad -import Test.HUnit (Assertion, (@?=)) -import Test.Framework (Test) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, (@?=), testCase) -- Tests: @@ -147,8 +146,8 @@ testReceive transport rtable = do node <- newLocalNode transport rtable runProcess node $ master -tests :: TestTransport -> IO [Test] +tests :: TestTransport -> IO TestTree tests TestTransport{..} = do let rtable = initRemoteTable - return + return $ testGroup "Receive" [ testCase "testReceive" (testReceive testTransport rtable) ] diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Stats.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Stats.hs index bb98afdd..494ec561 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Stats.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Stats.hs @@ -16,12 +16,8 @@ import Control.Distributed.Process.Node import Data.Binary () import Data.Typeable () -import Test.Framework - ( Test - , testGroup - ) -import Test.HUnit (Assertion) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, testCase) testLocalDeadProcessInfo :: TestResult (Maybe ProcessInfo) -> Process () testLocalDeadProcessInfo result = do @@ -107,10 +103,10 @@ testRemoteLiveProcessInfo TestTransport{..} node1 = do a <- delayedAssertion "getProcessInfo remotePid failed" n True return a -tests :: TestTransport -> IO [Test] +tests :: TestTransport -> IO TestTree tests testtrans@TestTransport{..} = do node1 <- newLocalNode testTransport initRemoteTable - return [ + return $ testGroup "Stats" [ testGroup "Process Info" [ testCase "testLocalDeadProcessInfo" (delayedAssertion diff --git a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Tracing.hs b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Tracing.hs index 9813447b..e91bfa73 100644 --- a/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Tracing.hs +++ b/packages/distributed-process-tests/src/Control/Distributed/Process/Tests/Tracing.hs @@ -25,11 +25,8 @@ import Data.List (isPrefixOf, isSuffixOf) import Prelude hiding ((<*)) -import Test.Framework - ( Test - , testGroup - ) -import Test.Framework.Providers.HUnit (testCase) +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit ( testCase) import System.Environment (getEnvironment) -- These are available in System.Environment only since base 4.7 import System.SetEnv (setEnv, unsetEnv) @@ -375,14 +372,14 @@ testSystemLoggerMxUnRegistered t = testSystemLoggerMsg t (getSelfPid >>= register "a" >> unregister "a" >> getSelfPid) (\self -> isPrefixOf $ "MxUnRegistered " ++ show self ++ " " ++ show "a") -tests :: TestTransport -> IO [Test] +tests :: TestTransport -> IO TestTree tests testtrans@TestTransport{..} = do node1 <- newLocalNode testTransport initRemoteTable -- if we execute the test cases in parallel, the -- various tracers will race with one another and -- we'll get garbage results (or worse, deadlocks) lock <- liftIO $ newMVar () - return [ + return $ testGroup "Tracing" [ testGroup "Tracing" [ testCase "Spawn Tracing" (synchronisedAssertion diff --git a/packages/distributed-process-tests/tests/runInMemory.hs b/packages/distributed-process-tests/tests/runInMemory.hs index 494e8cbb..3e2be3e4 100644 --- a/packages/distributed-process-tests/tests/runInMemory.hs +++ b/packages/distributed-process-tests/tests/runInMemory.hs @@ -6,9 +6,8 @@ import TEST_SUITE_MODULE (tests) import Network.Transport.Test (TestTransport(..)) import Network.Transport.InMemory -import Test.Framework (defaultMainWithArgs) - -import System.Environment (getArgs) +import Test.Tasty (defaultMain, localOption) +import Test.Tasty.Runners (NumThreads) main :: IO () main = do @@ -17,14 +16,12 @@ main = do { testTransport = transport , testBreakConnection = \addr1 addr2 -> breakConnection internals addr1 addr2 "user error" } - args <- getArgs -- Tests are time sensitive. Running the tests concurrently can slow them -- down enough that threads using threadDelay would wake up later than -- expected, thus changing the order in which messages were expected. - -- Therefore we run the tests sequentially by passing "-j 1" to - -- test-framework. This does not solve the issue but makes it less likely. + -- Therefore we run the tests sequentially -- -- The problem was first detected with -- 'Control.Distributed.Process.Tests.CH.testMergeChannels' -- in particular. - defaultMainWithArgs ts ("-j" : "1" : args) + defaultMain (localOption (1::NumThreads) ts) diff --git a/packages/distributed-process-tests/tests/runTCP.hs b/packages/distributed-process-tests/tests/runTCP.hs index 903aee26..bd29124f 100644 --- a/packages/distributed-process-tests/tests/runTCP.hs +++ b/packages/distributed-process-tests/tests/runTCP.hs @@ -13,11 +13,11 @@ import Network.Transport.TCP , defaultTCPAddr , TCPParameters(..) ) -import Test.Framework (defaultMainWithArgs) +import Test.Tasty (defaultMain, localOption) +import Test.Tasty.Runners (NumThreads) import Control.Concurrent (threadDelay) import Control.Exception (IOException, try) -import System.Environment (getArgs) import System.IO main :: IO () @@ -34,14 +34,12 @@ main = do either (\e -> const (return ()) (e :: IOException)) close esock threadDelay 10000 } - args <- getArgs -- Tests are time sensitive. Running the tests concurrently can slow them -- down enough that threads using threadDelay would wake up later than -- expected, thus changing the order in which messages were expected. - -- Therefore we run the tests sequentially by passing "-j 1" to - -- test-framework. This does not solve the issue but makes it less likely. + -- Therefore we run the tests sequentially -- -- The problem was first detected with -- 'Control.Distributed.Process.Tests.CH.testMergeChannels' -- in particular. - defaultMainWithArgs ts ("-j" : "1" : args) + defaultMain (localOption (1::NumThreads) ts) diff --git a/packages/distributed-process/distributed-process.cabal b/packages/distributed-process/distributed-process.cabal index 0bd03eeb..f6323d75 100644 --- a/packages/distributed-process/distributed-process.cabal +++ b/packages/distributed-process/distributed-process.cabal @@ -34,6 +34,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages source-repository head Type: git diff --git a/packages/distributed-static/distributed-static.cabal b/packages/distributed-static/distributed-static.cabal index 52dade4d..a70686c5 100644 --- a/packages/distributed-static/distributed-static.cabal +++ b/packages/distributed-static/distributed-static.cabal @@ -41,6 +41,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages Library import: warnings diff --git a/packages/network-transport-inmemory/network-transport-inmemory.cabal b/packages/network-transport-inmemory/network-transport-inmemory.cabal index e2974b3e..d3bc720d 100644 --- a/packages/network-transport-inmemory/network-transport-inmemory.cabal +++ b/packages/network-transport-inmemory/network-transport-inmemory.cabal @@ -39,6 +39,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages Library import: warnings diff --git a/packages/network-transport-tcp/ChangeLog b/packages/network-transport-tcp/ChangeLog index 1fe5d850..2da07edf 100644 --- a/packages/network-transport-tcp/ChangeLog +++ b/packages/network-transport-tcp/ChangeLog @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-09-03 Laurent P. René de Cotret 0.8.5 * Bumped dependency bounds to support GHC 8.10.7 - GHC 9.10.1 diff --git a/packages/network-transport-tcp/network-transport-tcp.cabal b/packages/network-transport-tcp/network-transport-tcp.cabal index 301efb99..6aa50cb2 100644 --- a/packages/network-transport-tcp/network-transport-tcp.cabal +++ b/packages/network-transport-tcp/network-transport-tcp.cabal @@ -30,6 +30,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages Flag use-mock-network Description: Use mock network implementation (for testing) @@ -81,9 +82,6 @@ Test-Suite TestQC Main-Is: TestQC.hs If flag(use-mock-network) Build-Depends: base >= 4.14 && < 5, - test-framework, - test-framework-quickcheck2, - test-framework-hunit, QuickCheck, HUnit, network-transport, diff --git a/packages/network-transport-tests/network-transport-tests.cabal b/packages/network-transport-tests/network-transport-tests.cabal index 24a38d85..e9abc369 100644 --- a/packages/network-transport-tests/network-transport-tests.cabal +++ b/packages/network-transport-tests/network-transport-tests.cabal @@ -27,6 +27,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages library import: warnings diff --git a/packages/network-transport/network-transport.cabal b/packages/network-transport/network-transport.cabal index 94636eff..e458792a 100644 --- a/packages/network-transport/network-transport.cabal +++ b/packages/network-transport/network-transport.cabal @@ -73,6 +73,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages Library import: warnings diff --git a/packages/rank1dynamic/ChangeLog b/packages/rank1dynamic/ChangeLog index 6dace5cf..e9bf1809 100644 --- a/packages/rank1dynamic/ChangeLog +++ b/packages/rank1dynamic/ChangeLog @@ -1,3 +1,7 @@ +Unreleased + +* Ported test suite to use `tasty` rather than `test-framework`. + 2024-09-03 Laurent P. René de Cotret 0.4.2 * Bumped dependency bounds to support GHC 8.10.7 - GHC 9.10.1 diff --git a/packages/rank1dynamic/rank1dynamic.cabal b/packages/rank1dynamic/rank1dynamic.cabal index 3bbcfa7d..84f8f9b8 100644 --- a/packages/rank1dynamic/rank1dynamic.cabal +++ b/packages/rank1dynamic/rank1dynamic.cabal @@ -30,6 +30,7 @@ common warnings -Wredundant-constraints -fhide-source-paths -Wpartial-fields + -Wunused-packages Library import: warnings @@ -50,7 +51,7 @@ Test-Suite TestRank1Dynamic Build-Depends: base >= 4.14 && < 5, HUnit >= 1.2 && < 1.7, rank1dynamic, - test-framework >= 0.6 && < 0.9, - test-framework-hunit >= 0.2.0 && < 0.4 - default-language: Haskell2010 + tasty >= 1.5 && <1.6, + tasty-hunit >=0.10 && <0.11, + default-language: Haskell2010 HS-Source-Dirs: tests diff --git a/packages/rank1dynamic/tests/test.hs b/packages/rank1dynamic/tests/test.hs index 103494e4..022e5171 100644 --- a/packages/rank1dynamic/tests/test.hs +++ b/packages/rank1dynamic/tests/test.hs @@ -2,9 +2,8 @@ import Data.Rank1Dynamic import Data.Rank1Typeable -import Test.Framework -import Test.Framework.Providers.HUnit -import Test.HUnit hiding (Test) +import Test.Tasty +import Test.Tasty.HUnit import Unsafe.Coerce funKindStr :: String @@ -18,9 +17,9 @@ funKindStr = "(->)" main :: IO () -main = defaultMain tests +main = defaultMain (testGroup "rank1dynamic" tests) -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "Examples of isInstanceOf" [ testCase "CANNOT use a term of type 'Int -> Bool' as 'Int -> Int'" $