@@ -25,6 +25,7 @@ import qualified Test.Cardano.Ledger.Conway.Binary.Cddl as Conway
2525import qualified Test.Cardano.Ledger.Mary.Binary.Cddl as Mary
2626import qualified Test.Cardano.Ledger.Shelley.Binary.Cddl as Shelley
2727import Test.Tasty
28+ import Test.Util.Serialisation.CDDL (isCDDLCDisabled )
2829
2930newtype CDDLSpec = CDDLSpec { cddlSpec :: BS. ByteString} deriving Show
3031
@@ -34,32 +35,35 @@ newtype CDDLSpec = CDDLSpec {cddlSpec :: BS.ByteString} deriving Show
3435-- each CDDL so that we know always what is available.
3536withCDDLs :: TestTree -> TestTree
3637withCDDLs f =
37- withResource
38- ( do
39- probeTools
40- setupCDDLCEnv
41-
42- ntnBlock <- cddlc " cddl/node-to-node/blockfetch/block.cddl"
43- ntnBlock' <- fixupBlockCDDL ntnBlock
44- BS. writeFile " ntnblock.cddl" . cddlSpec $ ntnBlock'
45-
46- ntnHeader <- cddlc " cddl/node-to-node/chainsync/header.cddl"
47- BS. writeFile " ntnheader.cddl" . cddlSpec $ ntnHeader
48-
49- ntnTx <- cddlc " cddl/node-to-node/txsubmission2/tx.cddl"
50- ntnTx' <- fixupBlockCDDL ntnTx
51- BS. writeFile " ntntx.cddl" . cddlSpec $ ntnTx'
52-
53- ntnTxId <- cddlc " cddl/node-to-node/txsubmission2/txId.cddl"
54- BS. writeFile " ntntxid.cddl" . cddlSpec $ ntnTxId
55- )
56- ( \ () -> do
57- D. removeFile " ntnblock.cddl"
58- D. removeFile " ntnheader.cddl"
59- D. removeFile " ntntx.cddl"
60- D. removeFile " ntntxid.cddl"
61- )
62- (\ _ -> f)
38+ if isCDDLCDisabled
39+ then f
40+ else
41+ withResource
42+ ( do
43+ probeTools
44+ setupCDDLCEnv
45+
46+ ntnBlock <- cddlc " cddl/node-to-node/blockfetch/block.cddl"
47+ ntnBlock' <- fixupBlockCDDL ntnBlock
48+ BS. writeFile " ntnblock.cddl" . cddlSpec $ ntnBlock'
49+
50+ ntnHeader <- cddlc " cddl/node-to-node/chainsync/header.cddl"
51+ BS. writeFile " ntnheader.cddl" . cddlSpec $ ntnHeader
52+
53+ ntnTx <- cddlc " cddl/node-to-node/txsubmission2/tx.cddl"
54+ ntnTx' <- fixupBlockCDDL ntnTx
55+ BS. writeFile " ntntx.cddl" . cddlSpec $ ntnTx'
56+
57+ ntnTxId <- cddlc " cddl/node-to-node/txsubmission2/txId.cddl"
58+ BS. writeFile " ntntxid.cddl" . cddlSpec $ ntnTxId
59+ )
60+ ( \ () -> do
61+ D. removeFile " ntnblock.cddl"
62+ D. removeFile " ntnheader.cddl"
63+ D. removeFile " ntntx.cddl"
64+ D. removeFile " ntntxid.cddl"
65+ )
66+ (\ _ -> f)
6367
6468-- | The Ledger CDDL specs are not _exactly_ correct. Here we do some dirty
6569-- sed-replace to make them able to validate blocks. See cardano-ledger#5054.
0 commit comments