Skip to content

Commit 33abc7d

Browse files
authored
Merge pull request #5276 from IntersectMBO/geo2a/10.7-integration
Allow using `QuickCheck < 2.16`
2 parents cbd2526 + 2b1777f commit 33abc7d

File tree

19 files changed

+466
-18
lines changed

19 files changed

+466
-18
lines changed

cardano-diffusion/cardano-diffusion.cabal

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@ common ghc-options
4747
-- in tests librararies redundant constraints are sometimes useful (e.g.
4848
-- by default truned off debug tracing might require extra constraints like
4949
-- `Show` or `MonadSay`).
50+
--
51+
-- TODO: '-Wno-redundant-constraints' remove when we support
52+
-- `quickcheck-monoids`. For now, it is needed to prevent
53+
-- false-positives that lead to build errors with `-Werror`.
54+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/24173 for details.
5055
common ghc-options-tests
5156
import: ghc-options
52-
ghc-options: -Wno-redundant-constraints
57+
ghc-options:
58+
-Wno-redundant-constraints
59+
-Wno-unused-packages
5360

5461
library api
5562
import: ghc-options
@@ -430,10 +437,13 @@ test-suite protocols-bench
430437

431438
library cardano-diffusion-tests-lib
432439
import: ghc-options-tests
440+
mixins:
441+
QuickCheck hiding (Test.QuickCheck.Monoids)
442+
433443
visibility: public
434444
hs-source-dirs: tests/lib
435445
build-depends:
436-
QuickCheck >=2.16,
446+
QuickCheck,
437447
aeson,
438448
base >=4.14 && <4.23,
439449
bytestring,
@@ -453,6 +463,7 @@ library cardano-diffusion-tests-lib
453463
pipes,
454464
pretty-simple,
455465
psqueues,
466+
quickcheck-monoids,
456467
random,
457468
serialise,
458469
tasty,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
<!--
9+
### Breaking
10+
11+
- A bullet item for the Breaking category.
12+
13+
-->
14+
15+
### Non-Breaking
16+
17+
- Compatibility with both `QuickCheck` < 2.15 and >= 2.16

cardano-diffusion/tests/lib/Test/Cardano/Network/Diffusion/Testnet.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE NamedFieldPuns #-}
44
{-# LANGUAGE NumericUnderscores #-}
55
{-# LANGUAGE OverloadedStrings #-}
6+
{-# LANGUAGE PackageImports #-}
67
{-# LANGUAGE RankNTypes #-}
78
{-# LANGUAGE ScopedTypeVariables #-}
89
{-# LANGUAGE TypeApplications #-}
@@ -107,6 +108,9 @@ import Test.Ouroboros.Network.TxSubmission.Types (Tx (..), TxId)
107108
import Test.Ouroboros.Network.Utils hiding (SmallDelay, debugTracer)
108109

109110
import Test.QuickCheck
111+
#if !MIN_VERSION_QuickCheck(2,16,0)
112+
import "quickcheck-monoids" Test.QuickCheck.Monoids
113+
#endif
110114
import Test.Tasty
111115
import Test.Tasty.QuickCheck (testProperty)
112116

cardano-diffusion/tests/lib/Test/Cardano/Network/PeerSelection.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ import Cardano.Network.PeerSelection.Governor.Types qualified as Cardano.ExtraSi
8989
import Cardano.Network.PeerSelection.State.LocalRootPeers qualified as LocalRootPeers
9090
import Ouroboros.Network.BlockFetch (FetchMode (..), PraosFetchMode (..))
9191
import Test.QuickCheck
92+
#if !MIN_VERSION_QuickCheck(2,16,0)
93+
import "quickcheck-monoids" Test.QuickCheck.Monoids
94+
#endif
9295
import Test.Tasty
9396
import Test.Tasty.QuickCheck
9497
import Text.Pretty.Simple
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
<!--
9+
### Breaking
10+
11+
- A bullet item for the Breaking category.
12+
13+
-->
14+
15+
### Non-Breaking
16+
17+
- Compatibility with both `QuickCheck` < 2.15 and >= 2.16

ouroboros-network/framework/sim-tests/Test/Ouroboros/Network/Server/Sim.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
{-# LANGUAGE StandaloneDeriving #-}
1616
{-# LANGUAGE TypeApplications #-}
1717
{-# LANGUAGE TypeOperators #-}
18+
#if !MIN_VERSION_QuickCheck(2,16,0)
19+
{-# LANGUAGE PackageImports #-}
20+
#endif
1821

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

6669
import Test.QuickCheck
70+
#if !MIN_VERSION_QuickCheck(2,16,0)
71+
import "quickcheck-monoids" Test.QuickCheck.Monoids
72+
#endif
6773
import Test.Tasty (TestTree, testGroup)
6874
import Test.Tasty.QuickCheck
6975

ouroboros-network/framework/tests-lib/Test/Ouroboros/Network/ConnectionManager/Timeouts.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{-# LANGUAGE LambdaCase #-}
22
{-# LANGUAGE NamedFieldPuns #-}
3+
{-# LANGUAGE PackageImports #-}
4+
5+
{-# LANGUAGE CPP #-}
36

47
module Test.Ouroboros.Network.ConnectionManager.Timeouts
58
( verifyAllTimeouts
@@ -39,6 +42,9 @@ import Data.Monoid (Sum (Sum))
3942
import Text.Printf (printf)
4043

4144
import Test.QuickCheck
45+
#if !MIN_VERSION_QuickCheck(2,16,0)
46+
import "quickcheck-monoids" Test.QuickCheck.Monoids
47+
#endif
4248

4349
import Ouroboros.Network.ConnectionHandler (ConnectionHandlerTrace)
4450
import Ouroboros.Network.ConnectionManager.Core qualified as CM

ouroboros-network/framework/tests-lib/Test/Ouroboros/Network/ConnectionManager/Utils.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{-# LANGUAGE NamedFieldPuns #-}
2+
{-# LANGUAGE PackageImports #-}
23
{-# LANGUAGE ScopedTypeVariables #-}
34

5+
{-# LANGUAGE CPP #-}
6+
47
module Test.Ouroboros.Network.ConnectionManager.Utils where
58

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

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

1420

1521
verifyAbstractTransition :: AbstractTransition

ouroboros-network/framework/tests-lib/Test/Ouroboros/Network/InboundGovernor/Utils.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
{-# LANGUAGE LambdaCase #-}
22
{-# LANGUAGE NamedFieldPuns #-}
3+
{-# LANGUAGE PackageImports #-}
34
{-# LANGUAGE PatternSynonyms #-}
45
{-# LANGUAGE ViewPatterns #-}
56

7+
{-# LANGUAGE CPP #-}
8+
69
module Test.Ouroboros.Network.InboundGovernor.Utils where
710

811
import Test.QuickCheck
12+
#if !MIN_VERSION_QuickCheck(2,16,0)
13+
import "quickcheck-monoids" Test.QuickCheck.Monoids
14+
#endif
915

1016
import Ouroboros.Network.ConnectionManager.Types
1117
import Ouroboros.Network.InboundGovernor (RemoteSt (..))

ouroboros-network/ouroboros-network.cabal

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,16 @@ common ghc-options
5555
-- in tests librararies redundant constraints are sometimes useful (e.g.
5656
-- by default truned off debug tracing might require extra constraints like
5757
-- `Show` or `MonadSay`).
58+
--
59+
-- TODO: '-Wno-redundant-constraints' remove when we support
60+
-- `quickcheck-monoids`. For now, it is needed to prevent
61+
-- false-positives that lead to build errors with `-Werror`.
62+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/24173 for details.
5863
common ghc-options-tests
5964
import: ghc-options
60-
ghc-options: -Wno-redundant-constraints
65+
ghc-options:
66+
-Wno-redundant-constraints
67+
-Wno-unused-packages
6168

6269
library api
6370
import: ghc-options
@@ -450,7 +457,7 @@ library tests-lib
450457
cpp-options: -DNIGHTLY
451458

452459
test-suite tests-lib-tests
453-
import: ghc-options
460+
import: ghc-options-tests
454461
type: exitcode-stdio-1.0
455462
main-is: Main.hs
456463
hs-source-dirs: tests-lib/tests
@@ -467,7 +474,10 @@ test-suite tests-lib-tests
467474
-threaded
468475

469476
library framework-tests-lib
470-
import: ghc-options
477+
import: ghc-options-tests
478+
mixins:
479+
QuickCheck hiding (Test.QuickCheck.Monoids)
480+
471481
visibility: public
472482
hs-source-dirs: framework/tests-lib
473483
exposed-modules:
@@ -479,7 +489,7 @@ library framework-tests-lib
479489
Test.Ouroboros.Network.RawBearer.Utils
480490

481491
build-depends:
482-
QuickCheck >=2.16,
492+
QuickCheck,
483493
base >=4.14 && <4.23,
484494
bytestring,
485495
cborg,
@@ -490,12 +500,16 @@ library framework-tests-lib
490500
io-sim,
491501
network-mux,
492502
ouroboros-network:{api, framework, tests-lib},
503+
quickcheck-monoids,
493504
random,
494505
serialise,
495506
typed-protocols:{typed-protocols, examples},
496507

497508
test-suite framework-sim-tests
498-
import: ghc-options
509+
import: ghc-options-tests
510+
mixins:
511+
QuickCheck hiding (Test.QuickCheck.Monoids)
512+
499513
type: exitcode-stdio-1.0
500514
main-is: Main.hs
501515
hs-source-dirs: framework/sim-tests
@@ -507,7 +521,7 @@ test-suite framework-sim-tests
507521
Test.Simulation.Network.Snocket
508522

509523
build-depends:
510-
QuickCheck >=2.16,
524+
QuickCheck,
511525
base >=4.14 && <4.23,
512526
bytestring,
513527
cborg,
@@ -521,6 +535,7 @@ test-suite framework-sim-tests
521535
pretty-simple,
522536
psqueues,
523537
quickcheck-instances,
538+
quickcheck-monoids,
524539
quiet,
525540
random,
526541
serialise,
@@ -538,7 +553,7 @@ test-suite framework-sim-tests
538553
cpp-options: -DOUROBOROS_NETWORK_IPV6
539554

540555
test-suite framework-io-tests
541-
import: ghc-options
556+
import: ghc-options-tests
542557
type: exitcode-stdio-1.0
543558
main-is: Main.hs
544559
hs-source-dirs: framework/io-tests
@@ -549,7 +564,7 @@ test-suite framework-io-tests
549564
Test.Ouroboros.Network.Socket
550565

551566
build-depends:
552-
QuickCheck >=2.16,
567+
QuickCheck,
553568
base >=4.14 && <4.23,
554569
bytestring,
555570
contra-tracer,
@@ -574,7 +589,7 @@ test-suite framework-io-tests
574589
-threaded
575590

576591
library orphan-instances
577-
import: ghc-options
592+
import: ghc-options-tests
578593
visibility: public
579594
hs-source-dirs: orphan-instances
580595
exposed-modules:
@@ -733,7 +748,7 @@ library protocols
733748
typed-protocols:{typed-protocols, cborg, stateful, stateful-cborg} ^>=1.1,
734749

735750
library protocols-tests-lib
736-
import: ghc-options
751+
import: ghc-options-tests
737752
visibility: public
738753
hs-source-dirs: protocols/tests-lib
739754
exposed-modules:
@@ -817,10 +832,13 @@ test-suite protocols-tests
817832
-- Simulation Test Library
818833
library ouroboros-network-tests-lib
819834
import: ghc-options-tests
835+
mixins:
836+
QuickCheck hiding (Test.QuickCheck.Monoids)
837+
820838
visibility: public
821839
hs-source-dirs: tests/lib
822840
build-depends:
823-
QuickCheck >=2.16,
841+
QuickCheck,
824842
aeson,
825843
array,
826844
base >=4.14 && <4.23,
@@ -843,6 +861,7 @@ library ouroboros-network-tests-lib
843861
nothunks,
844862
ouroboros-network:{ouroboros-network, api, api-tests-lib, framework, protocols, protocols-tests-lib, tests-lib},
845863
pretty-simple,
864+
quickcheck-monoids,
846865
random,
847866
serialise,
848867
splitmix,
@@ -851,6 +870,7 @@ library ouroboros-network-tests-lib
851870
tasty-quickcheck,
852871
text,
853872
time >=1.9.1 && <1.16,
873+
transformers-except,
854874
typed-protocols,
855875

856876
exposed-modules:
@@ -913,7 +933,7 @@ test-suite ouroboros-network-io-tests
913933
Test.Ouroboros.Network.Socket
914934

915935
build-depends:
916-
QuickCheck >=2.16,
936+
QuickCheck,
917937
base >=4.14 && <4.23,
918938
bytestring,
919939
cborg,

0 commit comments

Comments
 (0)