mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
d1c8972b09
commit
36b9eb090a
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue