diff options
-rw-r--r-- | app/Main.hs | 7 | ||||
-rw-r--r-- | src/VeriFuzz/Fuzz.hs | 20 |
2 files changed, 20 insertions, 7 deletions
diff --git a/app/Main.hs b/app/Main.hs index 3e14b03..4e6b3bc 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -199,10 +199,9 @@ getConfig = maybe (return V.defaultConfig) V.parseConfigFile handleOpts :: Opts -> IO () handleOpts (Fuzz out configF _ _) = do config <- getConfig configF - _ <- V.runFuzz - config - V.defaultYosys - (V.fuzzMultiple 5 (S.fromText out) (V.proceduralSrc "top" config)) + _ <- V.runFuzz config + V.defaultYosys + (V.fuzzMultiple 5 Nothing (V.proceduralSrc "top" config)) return () handleOpts (Generate f c) = do config <- getConfig c diff --git a/src/VeriFuzz/Fuzz.hs b/src/VeriFuzz/Fuzz.hs index dd3bfd4..c0e6117 100644 --- a/src/VeriFuzz/Fuzz.hs +++ b/src/VeriFuzz/Fuzz.hs @@ -34,6 +34,7 @@ import Control.Monad.Trans.State.Strict import Data.ByteString (ByteString) import Data.List (nubBy) import Data.Text (Text) +import qualified Data.Text as T import Data.Time import Hedgehog (Gen) import qualified Hedgehog.Gen as Hog @@ -165,9 +166,22 @@ fuzzInDir fp src = do pop fp $ fuzz src fuzzMultiple - :: MonadFuzz m => Int -> FilePath -> Gen SourceInfo -> Fuzz m FuzzReport + :: MonadFuzz m + => Int + -> (Maybe FilePath) + -> Gen SourceInfo + -> Fuzz m FuzzReport fuzzMultiple n fp src = do - make fp - void . pop fp $ forM [1 .. n] fuzzDir + x <- case fp of + Nothing -> do + ct <- liftIO getZonedTime + return + . fromText + . T.pack + $ "output_" + <> formatTime defaultTimeLocale "%Y-%m-%d_%H-%M-%S" ct + Just f -> return f + make x + void . pop x $ forM [1 .. n] fuzzDir return mempty where fuzzDir n' = fuzzInDir (fromText $ "fuzz_" <> showT n') src |