diff --git a/cardano-testnet/src/Testnet/Property/Utils.hs b/cardano-testnet/src/Testnet/Property/Utils.hs index 447c2d637c9..df535e02736 100644 --- a/cardano-testnet/src/Testnet/Property/Utils.hs +++ b/cardano-testnet/src/Testnet/Property/Utils.hs @@ -27,7 +27,8 @@ import Cardano.Chain.Genesis (GenesisHash (unGenesisHash), readGenesis import qualified Cardano.Crypto.Hash.Blake2b as Crypto import qualified Cardano.Crypto.Hash.Class as Crypto -import qualified Control.Exception.Lifted as E +import qualified Control.Concurrent.QSem as IO +import qualified Control.Exception.Lifted as CE import Control.Exception.Safe (MonadCatch) import Control.Monad import Control.Monad.Trans.Resource @@ -55,11 +56,14 @@ disableRetries = IO.unsafePerformIO $ do return $ mValue == Just "1" {-# NOINLINE disableRetries #-} -sem :: +sem :: IO.QSem +sem = IO.unsafePerformIO $ IO.newQSem 1 +{-# NOINLINE sem #-} -- TODO: Document what an Integration is integration :: HasCallStack => H.Integration () -> H.Property -integration f = GHC.withFrozenCallStack $ H.withTests 1 $ H.propertyOnce $ E.bracket_ (pure ()) (pure ()) f +integration f = GHC.withFrozenCallStack $ H.withTests 1 $ H.propertyOnce $ + CE.bracket_ (liftIO $ IO.waitQSem sem) (liftIO $ IO.signalQSem sem) f -- | The 'FilePath' in '(FilePath -> H.Integration ())' is the work space directory. -- This is created (and returned) via 'H.workspace'.