Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cardano-diffusion/cardano-diffusion.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ common ghc-options
-- in tests librararies redundant constraints are sometimes useful (e.g.
-- by default truned off debug tracing might require extra constraints like
-- `Show` or `MonadSay`).
--
-- TODO: '-Wno-redundant-constraints' remove when we support
-- `quickcheck-monoids`. For now, it is needed to prevent
-- false-positives that lead to build errors with `-Werror`.
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/24173 for details.
common ghc-options-tests
import: ghc-options
ghc-options: -Wno-redundant-constraints
ghc-options:
-Wno-redundant-constraints
-Wno-unused-packages

library api
import: ghc-options
Expand Down Expand Up @@ -430,10 +437,13 @@ test-suite protocols-bench

library cardano-diffusion-tests-lib
import: ghc-options-tests
mixins:
QuickCheck hiding (Test.QuickCheck.Monoids)

visibility: public
hs-source-dirs: tests/lib
build-depends:
QuickCheck >=2.16,
QuickCheck,
aeson,
base >=4.14 && <4.23,
bytestring,
Expand All @@ -453,6 +463,7 @@ library cardano-diffusion-tests-lib
pipes,
pretty-simple,
psqueues,
quickcheck-monoids,
random,
serialise,
tasty,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Breaking

- A bullet item for the Breaking category.

-->

### Non-Breaking

- Compatibility with both `QuickCheck` < 2.15 and >= 2.16
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
Expand Down Expand Up @@ -107,6 +108,9 @@ import Test.Ouroboros.Network.TxSubmission.Types (Tx (..), TxId)
import Test.Ouroboros.Network.Utils hiding (SmallDelay, debugTracer)

import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif
import Test.Tasty
import Test.Tasty.QuickCheck (testProperty)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ import Cardano.Network.PeerSelection.Governor.Types qualified as Cardano.ExtraSi
import Cardano.Network.PeerSelection.State.LocalRootPeers qualified as LocalRootPeers
import Ouroboros.Network.BlockFetch (FetchMode (..), PraosFetchMode (..))
import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif
Comment on lines +92 to +93
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can squash this on top of the first commit, which contain similar changes.

import Test.Tasty
import Test.Tasty.QuickCheck
import Text.Pretty.Simple
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Breaking

- A bullet item for the Breaking category.

-->

### Non-Breaking

- Compatibility with both `QuickCheck` < 2.15 and >= 2.16
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
#if !MIN_VERSION_QuickCheck(2,16,0)
{-# LANGUAGE PackageImports #-}
#endif

-- for 'debugTracer'
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
Expand Down Expand Up @@ -64,6 +67,9 @@ import System.Random (StdGen, mkStdGen, split)
import Text.Printf

import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PackageImports #-}

{-# LANGUAGE CPP #-}

module Test.Ouroboros.Network.ConnectionManager.Timeouts
( verifyAllTimeouts
Expand Down Expand Up @@ -39,6 +42,9 @@ import Data.Monoid (Sum (Sum))
import Text.Printf (printf)

import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif

import Ouroboros.Network.ConnectionHandler (ConnectionHandlerTrace)
import Ouroboros.Network.ConnectionManager.Core qualified as CM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ScopedTypeVariables #-}

{-# LANGUAGE CPP #-}

module Test.Ouroboros.Network.ConnectionManager.Utils where

import Prelude hiding (read)
Expand All @@ -10,6 +13,9 @@ import Ouroboros.Network.ConnectionManager.Core as CM
import Ouroboros.Network.ConnectionManager.Types

import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif


verifyAbstractTransition :: AbstractTransition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}

{-# LANGUAGE CPP #-}

module Test.Ouroboros.Network.InboundGovernor.Utils where

import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif

import Ouroboros.Network.ConnectionManager.Types
import Ouroboros.Network.InboundGovernor (RemoteSt (..))
Expand Down
44 changes: 32 additions & 12 deletions ouroboros-network/ouroboros-network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ common ghc-options
-- in tests librararies redundant constraints are sometimes useful (e.g.
-- by default truned off debug tracing might require extra constraints like
-- `Show` or `MonadSay`).
--
-- TODO: '-Wno-redundant-constraints' remove when we support
-- `quickcheck-monoids`. For now, it is needed to prevent
-- false-positives that lead to build errors with `-Werror`.
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/24173 for details.
common ghc-options-tests
import: ghc-options
ghc-options: -Wno-redundant-constraints
ghc-options:
-Wno-redundant-constraints
-Wno-unused-packages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment, that this is only required until we support quickcheck-monoids.


library api
import: ghc-options
Expand Down Expand Up @@ -451,7 +458,7 @@ library tests-lib
cpp-options: -DNIGHTLY

test-suite tests-lib-tests
import: ghc-options
import: ghc-options-tests
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: tests-lib/tests
Expand All @@ -468,7 +475,10 @@ test-suite tests-lib-tests
-threaded

library framework-tests-lib
import: ghc-options
import: ghc-options-tests
mixins:
QuickCheck hiding (Test.QuickCheck.Monoids)

visibility: public
hs-source-dirs: framework/tests-lib
exposed-modules:
Expand All @@ -480,7 +490,7 @@ library framework-tests-lib
Test.Ouroboros.Network.RawBearer.Utils

build-depends:
QuickCheck >=2.16,
QuickCheck,
base >=4.14 && <4.23,
bytestring,
cborg,
Expand All @@ -491,12 +501,16 @@ library framework-tests-lib
io-sim,
network-mux,
ouroboros-network:{api, framework, tests-lib},
quickcheck-monoids,
random,
serialise,
typed-protocols:{typed-protocols, examples},

test-suite framework-sim-tests
import: ghc-options
import: ghc-options-tests
mixins:
QuickCheck hiding (Test.QuickCheck.Monoids)

type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: framework/sim-tests
Expand All @@ -508,7 +522,7 @@ test-suite framework-sim-tests
Test.Simulation.Network.Snocket

build-depends:
QuickCheck >=2.16,
QuickCheck,
base >=4.14 && <4.23,
bytestring,
cborg,
Expand All @@ -522,6 +536,7 @@ test-suite framework-sim-tests
pretty-simple,
psqueues,
quickcheck-instances,
quickcheck-monoids,
quiet,
random,
serialise,
Expand All @@ -539,7 +554,7 @@ test-suite framework-sim-tests
cpp-options: -DOUROBOROS_NETWORK_IPV6

test-suite framework-io-tests
import: ghc-options
import: ghc-options-tests
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: framework/io-tests
Expand All @@ -550,7 +565,7 @@ test-suite framework-io-tests
Test.Ouroboros.Network.Socket

build-depends:
QuickCheck >=2.16,
QuickCheck,
base >=4.14 && <4.23,
bytestring,
contra-tracer,
Expand All @@ -575,7 +590,7 @@ test-suite framework-io-tests
-threaded

library orphan-instances
import: ghc-options
import: ghc-options-tests
visibility: public
hs-source-dirs: orphan-instances
exposed-modules:
Expand Down Expand Up @@ -734,7 +749,7 @@ library protocols
typed-protocols:{typed-protocols, cborg, stateful, stateful-cborg} ^>=1.1,

library protocols-tests-lib
import: ghc-options
import: ghc-options-tests
visibility: public
hs-source-dirs: protocols/tests-lib
exposed-modules:
Expand Down Expand Up @@ -818,10 +833,13 @@ test-suite protocols-tests
-- Simulation Test Library
library ouroboros-network-tests-lib
import: ghc-options-tests
mixins:
QuickCheck hiding (Test.QuickCheck.Monoids)

visibility: public
hs-source-dirs: tests/lib
build-depends:
QuickCheck >=2.16,
QuickCheck,
aeson,
array,
base >=4.14 && <4.23,
Expand All @@ -844,6 +862,7 @@ library ouroboros-network-tests-lib
nothunks,
ouroboros-network:{ouroboros-network, api, api-tests-lib, framework, framework-tests-lib, protocols, protocols-tests-lib, tests-lib},
pretty-simple,
quickcheck-monoids,
random,
serialise,
splitmix,
Expand All @@ -852,6 +871,7 @@ library ouroboros-network-tests-lib
tasty-quickcheck,
text,
time >=1.9.1 && <1.16,
transformers-except,
typed-protocols,

exposed-modules:
Expand Down Expand Up @@ -914,7 +934,7 @@ test-suite ouroboros-network-io-tests
Test.Ouroboros.Network.Socket

build-depends:
QuickCheck >=2.16,
QuickCheck,
base >=4.14 && <4.23,
bytestring,
cborg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ import Ouroboros.Network.Mock.ChainGenerators ()
import Ouroboros.Network.Mock.ConcreteBlock (Block)

import Ouroboros.Network.Protocol.LocalStateQuery.Client
import Ouroboros.Network.Protocol.LocalStateQuery.Codec
import Ouroboros.Network.Protocol.LocalStateQuery.Codec hiding (Some (..))
import Ouroboros.Network.Protocol.LocalStateQuery.Codec qualified as LocalStateQuery
import Ouroboros.Network.Protocol.LocalStateQuery.Direct
import Ouroboros.Network.Protocol.LocalStateQuery.Examples
import Ouroboros.Network.Protocol.LocalStateQuery.Server
import Ouroboros.Network.Protocol.LocalStateQuery.Type

import Test.Ouroboros.Network.Protocol.Utils

import Test.QuickCheck as QC hiding (Result, Some (Some))
import Test.QuickCheck as QC hiding (Result)
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import Text.Show.Functions ()
Expand Down Expand Up @@ -386,10 +387,10 @@ codec =
encodeQuery :: Query result -> CBOR.Encoding
encodeQuery GetTheLedgerState = Serialise.encode ()

decodeQuery :: forall s . CBOR.Decoder s (Some Query)
decodeQuery :: forall s . CBOR.Decoder s (LocalStateQuery.Some Query)
decodeQuery = do
() <- Serialise.decode
return $ Some GetTheLedgerState
return $ LocalStateQuery.Some GetTheLedgerState

encodeResult :: Query result -> result -> CBOR.Encoding
encodeResult GetTheLedgerState = Serialise.encode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ScopedTypeVariables #-}

#if __GLASGOW_HASKELL__ >= 908
Expand Down Expand Up @@ -49,6 +50,9 @@ import NoThunks.Class
import Test.Ouroboros.Network.Data.Script

import Test.QuickCheck
#if !MIN_VERSION_QuickCheck(2,16,0)
import "quickcheck-monoids" Test.QuickCheck.Monoids
#endif
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)

Expand Down
Loading