aboutsummaryrefslogtreecommitdiff
path: root/Command/FuzzTest.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-26 16:15:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-26 16:15:25 -0400
commit5bf239c6ce487148787de21799333325d22e54a4 (patch)
tree328fc0b42dec1724c1059fd44d2f408624e019cd /Command/FuzzTest.hs
parent23643a2fb180c01602a94e876ce024282dd9b04f (diff)
reduce the amount of subdirectories created by the fuzz tester to saner limit
Diffstat (limited to 'Command/FuzzTest.hs')
-rw-r--r--Command/FuzzTest.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Command/FuzzTest.hs b/Command/FuzzTest.hs
index f555a7375..34e74b433 100644
--- a/Command/FuzzTest.hs
+++ b/Command/FuzzTest.hs
@@ -131,15 +131,20 @@ mkFuzzFile file dirs = FuzzFile $ joinPath (map toFilePath dirs) </> ("fuzzfile_
mkFuzzDir :: Int -> FuzzDir
mkFuzzDir n = FuzzDir $ "fuzzdir_" ++ show n
+{- File is placed inside a directory hierarchy up to 4 subdirectories deep. -}
genFuzzFile :: IO FuzzFile
genFuzzFile = do
- n <- getStdRandom $ randomR (0, 5)
+ n <- getStdRandom $ randomR (0, 4)
dirs <- replicateM n genFuzzDir
file <- show <$> (getStdRandom random :: IO Int)
return $ mkFuzzFile file dirs
+{- Only 16 distinct subdirectories are used. When nested 4 deep, this
+ - yields 69904 total directories max, which is below the default Linux
+ - inotify limit of 81920. The goal is not to run the assistant out of
+ - inotify descriptors. -}
genFuzzDir :: IO FuzzDir
-genFuzzDir = mkFuzzDir <$> (getStdRandom random :: IO Int)
+genFuzzDir = mkFuzzDir <$> (getStdRandom (randomR (1,16)) :: IO Int)
localFile :: FilePath -> Bool
localFile f