Skip to content

Commit

Permalink
Fix the rebase and disable LMDB tests on MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Dec 2, 2022
1 parent 6d6a546 commit fd16dd8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
Expand Up @@ -213,6 +213,7 @@ data instance BlockQuery (ShelleyBlock proto era) :: FootprintL -> Type -> Type
GetPoolState
:: Maybe (Set (SL.KeyHash 'SL.StakePool (EraCrypto era)))
-> BlockQuery (ShelleyBlock proto era)
SmallL
(SL.PState (EraCrypto era))

GetStakeSnapshots
Expand Down Expand Up @@ -488,6 +489,13 @@ instance EqQuery (BlockQuery (ShelleyBlock proto era)) where
= Just Refl
eqQuery GetRewardInfoPools _
= Nothing
eqQuery (GetPoolState s) (GetPoolState s')
| s == s'
= Just Refl
| otherwise
= Nothing
eqQuery (GetPoolState _) _
= Nothing


instance SameDepIndex (BlockQuery (ShelleyBlock proto era) fp) where
Expand Down Expand Up @@ -654,6 +662,7 @@ instance (ShelleyCompatible proto era, EqQuery (BlockQuery (ShelleyBlock proto e
GetStakePools -> SmallQ
GetStakePoolParams {} -> SmallQ
GetRewardInfoPools {} -> SmallQ
GetPoolState {} -> SmallQ

-- | Is the given query supported by the given 'ShelleyNodeToClientVersion'?
querySupportedVersion :: BlockQuery (ShelleyBlock proto era) fp result -> ShelleyNodeToClientVersion -> Bool
Expand Down
5 changes: 3 additions & 2 deletions ouroboros-consensus-test/src/Test/Util/TestBlock.hs
Expand Up @@ -350,6 +350,7 @@ class ( Typeable ptype
, TickedTableStuff (LedgerState (TestBlockWith ptype))
, StowableLedgerTables (LedgerState (TestBlockWith ptype))
, ShowLedgerState (LedgerState (TestBlockWith ptype))
, SufficientSerializationForAnyBackingStore (LedgerState (TestBlockWith ptype))

, NoThunks (LedgerTables (LedgerState (TestBlockWith ptype)) SeqDiffMK)
, NoThunks (LedgerTables (LedgerState (TestBlockWith ptype)) ValuesMK)
Expand Down Expand Up @@ -895,8 +896,8 @@ instance DecodeDisk (TestBlockWith ptype) (AnnTip (TestBlockWith ptype))

instance ReconstructNestedCtxt Header (TestBlockWith ptype)

instance PayloadSemantics ptype => EncodeDisk (TestBlockWith ptype) (LedgerState (TestBlockWith ptype))
instance PayloadSemantics ptype => DecodeDisk (TestBlockWith ptype) (LedgerState (TestBlockWith ptype))
instance PayloadSemantics ptype => EncodeDisk (TestBlockWith ptype) (LedgerState (TestBlockWith ptype) EmptyMK)
instance PayloadSemantics ptype => DecodeDisk (TestBlockWith ptype) (LedgerState (TestBlockWith ptype) EmptyMK)

instance Serialise ptype => EncodeDiskDep (NestedCtxt Header) (TestBlockWith ptype)
instance Serialise ptype => DecodeDiskDep (NestedCtxt Header) (TestBlockWith ptype)
Expand Down
Expand Up @@ -69,6 +69,13 @@ import Ouroboros.Consensus.Node.ProtocolInfo (NumCoreNodes (..))
import qualified Ouroboros.Consensus.Storage.ChainDB.API as ChainDB
import Ouroboros.Consensus.Storage.ChainDB.Impl (ChainDbArgs (..))
import qualified Ouroboros.Consensus.Storage.ChainDB.Impl as ChainDBImpl
import Ouroboros.Consensus.Storage.FS.API (SomeHasFS (SomeHasFS))
import qualified Ouroboros.Consensus.Storage.ImmutableDB as ImmutableDB
import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy
(SnapshotInterval (DefaultSnapshotInterval),
defaultDiskPolicy)
import qualified Ouroboros.Consensus.Storage.LedgerDB.OnDisk as LedgerDB
import qualified Ouroboros.Consensus.Storage.VolatileDB as VolatileDB
import Ouroboros.Consensus.Util.Condense (Condense (..))
import Ouroboros.Consensus.Util.IOLike
import Ouroboros.Consensus.Util.ResourceRegistry
Expand Down Expand Up @@ -246,6 +253,7 @@ runBlockFetchTest BlockFetchClientTestSetup{..} = withRegistry \registry -> do
, mcdbInitLedger = testInitExtLedger
, mcdbRegistry = registry
, mcdbNodeDBs = nodeDBs
, mcdbBackingStoreSelector = LedgerDB.InMemoryBackingStore
}
-- TODO: Test with more interesting behaviour for cdbCheckInFuture
pure $ args { cdbTracer = cdbTracer }
Expand Down
@@ -1,5 +1,7 @@
module Test.Ouroboros.Storage.LedgerDB (tests) where

import System.Info (os)

import Test.Tasty

import qualified Test.Ouroboros.Storage.LedgerDB.DbChangelog as DbChangelog
Expand All @@ -9,10 +11,9 @@ import qualified Test.Ouroboros.Storage.LedgerDB.InMemory as InMemory
import qualified Test.Ouroboros.Storage.LedgerDB.OnDisk as OnDisk

tests :: TestTree
tests = testGroup "LedgerDB" [
HD.tests
, InMemory.tests
, OnDisk.tests
, DiskPolicy.tests
, DbChangelog.tests
]
tests = testGroup "LedgerDB" ([ HD.tests | os /= "mingw32" ] <> -- FIXME: Should re-enable at some point, see #4022
[ InMemory.tests
, OnDisk.tests
, DiskPolicy.tests
, DbChangelog.tests
])
Expand Up @@ -57,6 +57,7 @@ import Data.Word
import GHC.Generics (Generic)
import qualified System.Directory as Dir
import qualified System.IO.Temp as Temp
import System.Info (os)
import System.Random (getStdRandom, randomR)

import qualified Test.QuickCheck as QC
Expand Down Expand Up @@ -102,11 +103,14 @@ import Test.Ouroboros.Storage.LedgerDB.OrphanArbitrary ()

tests :: TestTree
tests = askOption $ \showTrace -> testGroup "OnDisk"
[ TTT.testPropertyTraceable' "LedgerSimple-InMem" $
prop_sequential 100000 (inMemDbEnv showTrace) uniform
, TTT.testPropertyTraceable' "LedgerSimple-LMDB" $
prop_sequential 2000 (lmdbDbEnv showTrace testLMDBLimits) lmdbCustom
]
([ TTT.testPropertyTraceable' "LedgerSimple-InMem" $
prop_sequential 100000 (inMemDbEnv showTrace) uniform
] <>
[ TTT.testPropertyTraceable' "LedgerSimple-LMDB" $
prop_sequential 2000 (lmdbDbEnv showTrace testLMDBLimits) lmdbCustom
| os /= "mingw32" -- FIXME: Should re-enable at some point, see #4022
]
)
where
uniform = CmdDistribution
{ freqCurrent = 1
Expand Down
Expand Up @@ -122,7 +122,7 @@ initSlotForgeTimeOracle cfg chainDB = do
pure slotForgeTime
where
toSummary ::
ExtLedgerState blk
ExtLedgerState blk EmptyMK
-> History.Summary (History.HardForkIndices blk)
toSummary = History.hardForkSummary (configLedger cfg) . ledgerState

Expand Down

0 comments on commit fd16dd8

Please sign in to comment.