-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #514 from elopez/dev-windows-tests-4
Re-enable dapp tests on Windows
- Loading branch information
Showing
4 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,16 @@ import Data.String.Here | |
import Data.Text (Text) | ||
import Data.Text qualified as T | ||
import Data.Text.IO qualified as T | ||
import GHC.IO.Handle (hClose) | ||
import GHC.IO.Exception (IOErrorType(..)) | ||
import GHC.Natural | ||
import Paths_hevm qualified as Paths | ||
import System.Directory | ||
import System.FilePath ((</>)) | ||
import System.IO.Temp | ||
import System.Process | ||
import System.Exit | ||
import System.IO | ||
import System.IO.Error (mkIOError) | ||
|
||
import EVM.Dapp (dappInfo, emptyDapp) | ||
import EVM.Fetch (RpcInfo) | ||
|
@@ -65,6 +67,21 @@ testOpts solvers root buildOutput match maxIter allowFFI rpcinfo = do | |
, ffiAllowed = allowFFI | ||
} | ||
|
||
processFailedException :: String -> String -> [String] -> Int -> IO a | ||
processFailedException fun cmd args exit_code = | ||
ioError (mkIOError OtherError (fun ++ ": " ++ cmd ++ | ||
concatMap ((' ':) . show) args ++ | ||
" (exit " ++ show exit_code ++ ")") | ||
Nothing Nothing) | ||
|
||
callProcessCwd :: FilePath -> [String] -> FilePath -> IO () | ||
callProcessCwd cmd args cwd = do | ||
exit_code <- withCreateProcess (proc cmd args) { cwd = Just cwd, delegate_ctlc = True } $ \_ _ _ p -> | ||
waitForProcess p | ||
case exit_code of | ||
ExitSuccess -> return () | ||
ExitFailure r -> processFailedException "callProcess" cmd args r | ||
|
||
compile :: App m => ProjectType -> FilePath -> FilePath -> m (Either String BuildOutput) | ||
compile DappTools root src = do | ||
json <- liftIO $ compileWithDSTest src | ||
|
@@ -98,8 +115,8 @@ compile foundryType root src = do | |
_ <- readProcessWithExitCode "git" ["init", tld] "" | ||
callProcess "git" ["config", "--file", tld </> ".git" </> "config", "user.name", "'hevm'"] | ||
callProcess "git" ["config", "--file", tld </> ".git" </> "config", "user.email", "'[email protected]'"] | ||
callProcess "git" ["--git-dir", tld </> ".git", "--work-tree", tld, "add", tld] | ||
_ <- readProcessWithExitCode "git" ["--git-dir", tld </> ".git", "--work-tree", tld, "--no-gpg-sign", "commit", "-m"] "" | ||
callProcessCwd "git" ["add", "."] tld | ||
callProcessCwd "git" ["commit", "-m", "", "--allow-empty-message", "--no-gpg-sign"] tld | ||
pure () | ||
|
||
-- We don't want to depend on dapptools here, so we cheat and just call solc with the same options that dapp itself uses | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters