This commit is contained in:
Dmitry Zuikov 2023-01-27 10:06:11 +03:00
parent d1c8972b09
commit 36b9eb090a
2 changed files with 9 additions and 11 deletions

View File

@ -33,8 +33,8 @@ outputs = { self, nixpkgs, haskell-flake-utils, ... }@inputs:
packagePostOverrides = { pkgs }: with pkgs; with haskell.lib; [ packagePostOverrides = { pkgs }: with pkgs; with haskell.lib; [
disableExecutableProfiling enableExecutableProfiling
disableLibraryProfiling enableLibraryProfiling
dontBenchmark dontBenchmark
dontCoverage dontCoverage
dontDistribute dontDistribute

View File

@ -39,6 +39,12 @@ main = do
bytes <- B8.pack <$> replicateM size (uniformM g) bytes <- B8.pack <$> replicateM size (uniformM g)
let hash = hashObject bytes
let psz = calcChunks (fromIntegral size) (fromIntegral chu)
psz' <- shuffleM psz
withSystemTempDirectory "cww-test" $ \dir -> do withSystemTempDirectory "cww-test" $ \dir -> do
let opts = [ StoragePrefix (dir </> ".test-cww") let opts = [ StoragePrefix (dir </> ".test-cww")
@ -63,20 +69,12 @@ main = do
failed <- replicateM times $ do failed <- replicateM times $ do
let hash = hashObject bytes forConcurrently_ psz' $ \(o,s) -> do
let psz = calcChunks (fromIntegral size) (fromIntegral chu)
psz' <- shuffleM psz
forM_ psz' $ \(o,s) -> do
let t = B8.take s $ B8.drop o bytes let t = B8.take s $ B8.drop o bytes
writeChunk cw 1 hash (fromIntegral o) t writeChunk cw 1 hash (fromIntegral o) t
h2 <- getHash cw 1 hash h2 <- getHash cw 1 hash
-- commitBlock cw 1 hash
if Just hash /= h2 then do if Just hash /= h2 then do
pure [1] pure [1]
else do else do