make fuzz test also output its actions to stdout

This commit is contained in:
Joey Hess 2013-05-25 15:52:28 -04:00
parent 564350ff90
commit 8b5b4522d1

View file

@ -53,17 +53,18 @@ guardTest = unlessM (fromMaybe False . Git.Config.isTrue <$> getConfig key "") $
fuzz :: Handle -> Annex () fuzz :: Handle -> Annex ()
fuzz logh = do fuzz logh = do
action <- genFuzzAction action <- genFuzzAction
liftIO $ do record logh $ flip Started action
now <- getCurrentTime
hPrint logh $ Started now action
hFlush logh
result <- tryAnnex $ runFuzzAction action result <- tryAnnex $ runFuzzAction action
liftIO $ do record logh $ flip Finished $
now <- getCurrentTime either (const False) (const True) result
hPrint logh $
Finished now $ record :: Handle -> (UTCTime -> TimeStampedFuzzAction) -> Annex ()
either (const False) (const True) result record h tmpl = liftIO $ do
hFlush logh now <- getCurrentTime
let s = show $ tmpl now
print s
hPrint h s
hFlush h
{- Delay for either a fraction of a second, or a few seconds, or up {- Delay for either a fraction of a second, or a few seconds, or up
- to 1 minute. -} - to 1 minute. -}