testremote --fast

This commit is contained in:
Joey Hess 2014-08-03 18:08:34 -04:00
parent c648548e1f
commit 93f20541f5
2 changed files with 16 additions and 6 deletions

View file

@ -59,8 +59,9 @@ start basesz ws = do
showStart "testremote" name showStart "testremote" name
r <- either error id <$> Remote.byName' name r <- either error id <$> Remote.byName' name
showSideAction "generating test keys" showSideAction "generating test keys"
ks <- mapM randKey (keySizes basesz) fast <- Annex.getState Annex.fast
rs <- catMaybes <$> mapM (adjustChunkSize r) (chunkSizes basesz) ks <- mapM randKey (keySizes basesz fast)
rs <- catMaybes <$> mapM (adjustChunkSize r) (chunkSizes basesz fast)
rs' <- concat <$> mapM encryptionVariants rs rs' <- concat <$> mapM encryptionVariants rs
next $ perform rs' ks next $ perform rs' ks
@ -161,22 +162,29 @@ cleanup rs ks ok = do
forM_ ks removeAnnex forM_ ks removeAnnex
return ok return ok
chunkSizes :: Int -> [Int] chunkSizes :: Int -> Bool -> [Int]
chunkSizes base = chunkSizes base False =
[ 0 -- no chunking [ 0 -- no chunking
, base `div` 100 , base `div` 100
, base `div` 1000 , base `div` 1000
, base , base
] ]
chunkSizes base True =
[ 0
]
keySizes :: Int -> [Int] keySizes :: Int -> Bool -> [Int]
keySizes base = filter (>= 0) keySizes base fast = filter want
[ 0 -- empty key is a special case when chunking [ 0 -- empty key is a special case when chunking
, base , base
, base + 1 , base + 1
, base - 1 , base - 1
, base * 2 , base * 2
] ]
where
want sz
| fast = sz <= base && sz > 0
| otherwise = sz > 0
randKey :: Int -> Annex Key randKey :: Int -> Annex Key
randKey sz = withTmpFile "randkey" $ \f h -> do randKey sz = withTmpFile "randkey" $ \f h -> do

View file

@ -974,6 +974,8 @@ subdirectories).
It's safe to run in an existing repository (the repository contents are It's safe to run in an existing repository (the repository contents are
not altered), although it may perform expensive data transfers. not altered), although it may perform expensive data transfers.
To perform a smaller set of tests, use --fast.
The --size option can be used to tune the size of the generated objects. The --size option can be used to tune the size of the generated objects.
Testing a single remote will use the remote's configuration, Testing a single remote will use the remote's configuration,