diff options
-rw-r--r-- | src/VeriFuzz.hs | 4 | ||||
-rw-r--r-- | src/VeriFuzz/Sim/Internal.hs | 10 | ||||
-rw-r--r-- | verifuzz.cabal | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/VeriFuzz.hs b/src/VeriFuzz.hs index 054db72..c448c0b 100644 --- a/src/VeriFuzz.hs +++ b/src/VeriFuzz.hs @@ -415,7 +415,7 @@ checkEquivalence src dir = shellyFailDir $ do setenv "VERIFUZZ_ROOT" curr cd (fromText dir) catch_sh - ( (runResultT $ runEquiv defaultYosys (Just defaultVivado) src) + ( (runResultT $ runEquiv defaultYosys defaultVivado src) >> return True ) ((\_ -> return False) :: RunFailed -> Sh Bool) @@ -442,7 +442,7 @@ runEquivalence seed gm t d k i = do _ <- catch_sh ( runResultT - $ runEquiv defaultYosys (Just defaultVivado) srcInfo + $ runEquiv defaultYosys defaultVivado srcInfo >> liftSh (logger "Test OK") ) $ onFailure n diff --git a/src/VeriFuzz/Sim/Internal.hs b/src/VeriFuzz/Sim/Internal.hs index a11fbd3..091520c 100644 --- a/src/VeriFuzz/Sim/Internal.hs +++ b/src/VeriFuzz/Sim/Internal.hs @@ -14,6 +14,7 @@ Class of the simulator and the synthesize tool. module VeriFuzz.Sim.Internal ( ResultSh + , resultSh , Tool(..) , Simulator(..) , Synthesiser(..) @@ -39,6 +40,7 @@ where import Control.Lens import Control.Monad (forM, void) +import Control.Monad.Catch (throwM) import Data.Bits (shiftL) import Data.ByteString (ByteString) import qualified Data.ByteString as B @@ -51,6 +53,7 @@ import Prelude hiding (FilePath) import Shelly import Shelly.Lifted (MonadSh, liftSh) import System.FilePath.Posix (takeBaseName) +import VeriFuzz.Internal import VeriFuzz.Result import VeriFuzz.Verilog.AST @@ -95,6 +98,13 @@ class Tool a => Synthesiser a where -- with also has those instances. type ResultSh = ResultT Failed Sh +resultSh :: ResultSh a -> Sh a +resultSh s = do + result <- runResultT s + case result of + Fail e -> throwM . RunFailed "" [] 1 $ showT e + Pass s' -> return s' + checkPresent :: FilePath -> Text -> Sh (Maybe Text) checkPresent fp t = do errExit False $ run_ "grep" [t, toTextIgnore fp] diff --git a/verifuzz.cabal b/verifuzz.cabal index ac44a1e..a765b1a 100644 --- a/verifuzz.cabal +++ b/verifuzz.cabal @@ -91,6 +91,7 @@ library , deepseq >= 1.4.4.0 && <1.5 , template-haskell >=2.14.0 && <2.15 , optparse-applicative >=0.14 && <0.15 + , exceptions >=0.10.2 && <0.11 default-extensions: OverloadedStrings executable verifuzz |