Skip to content
Snippets Groups Projects
Commit 03580e5b authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Merge branch 'workaround-zfec-corruption-in-tests' into 'main'

Single-threaded initialize zfec before letting the tests use it

See merge request !53
parents be0695ac c3b708d0
Branches
Tags
1 merge request!53Single-threaded initialize zfec before letting the tests use it
Pipeline #5377 passed
......@@ -4,6 +4,9 @@ import Test.Tasty (TestTree, defaultMain, testGroup)
import System.IO (hSetEncoding, stderr, stdout, utf8)
import qualified Codec.FEC as FEC
import Control.Exception (evaluate)
import Control.Monad (void)
import qualified SpecCHK
import qualified SpecCrypto
import qualified SpecMerkle
......@@ -39,6 +42,18 @@ main = do
hSetEncoding stdout utf8
hSetEncoding stderr utf8
-- fec <= 0.1.1 has a bug under multithreaded usage where concurrent
-- implicit initialization from different threads corrupts some of its
-- internal state. fec > 0.1.1 exposes an `initialize` function to allow
-- this to be avoided but for now we can just do any initialization prior
-- to multithreaded work to avoid this.
--
-- Use evaluate to force evaluation at this position in the IO, otherwise
-- we have no idea when `FEC.fec ...` will actually cause initialization
-- of the underlying lib. Replace this with `FEC.initialize` when
-- possible.
void $ evaluate $ FEC.fec 2 3
testVectors <- loadTestVectorData
let testVectorsTree =
either
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment