summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-17 16:45:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-17 16:45:44 -0400
commit0755035aab443a0a0a25c921dcee4174db02231f (patch)
treef1440bb74dffec6db8bf957979a7d2a5484b6f7a
parenta8f931e785775d0a4ef3c9b96f863ea57cdb3033 (diff)
try building test suite on windows
-rw-r--r--Test.hs14
-rw-r--r--git-annex.hs5
2 files changed, 12 insertions, 7 deletions
diff --git a/Test.hs b/Test.hs
index ce5fef3c7..456443aff 100644
--- a/Test.hs
+++ b/Test.hs
@@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Test where
import Test.HUnit
@@ -755,9 +757,10 @@ test_crypto env = "git-annex crypto" ~: intmpclonerepo env $ when Build.SysConfi
annexed_present annexedfile
-- This is equivilant to running git-annex, but it's all run in-process
--- so test coverage collection works.
+-- (when the OS allows) so test coverage collection works.
git_annex :: TestEnv -> String -> [String] -> IO Bool
git_annex env command params = do
+#ifndef __WINDOWS__
forM_ (M.toList env) $ \(var, val) ->
Utility.Env.setEnv var val True
@@ -768,12 +771,17 @@ git_annex env command params = do
Left _ -> return False
where
run = GitAnnex.run (command:"-q":params)
+#else
+ Utility.SafeCommand.boolSystemEnv "git-annex"
+ (map Param $ command : params)
+ (Just $ M.toList env)
+#endif
{- Runs git-annex and returns its output. -}
git_annex_output :: TestEnv -> String -> [String] -> IO String
git_annex_output env command params = do
- got <- Utility.Process.readProcessEnv "git-annex" (command:params) $
- Just $ M.toList env
+ got <- Utility.Process.readProcessEnv "git-annex" (command:params)
+ (Just $ M.toList env)
-- XXX since the above is a separate process, code coverage stats are
-- not gathered for things run in it.
-- Run same command again, to get code coverage.
diff --git a/git-annex.hs b/git-annex.hs
index b8b05a27c..0f45f53eb 100644
--- a/git-annex.hs
+++ b/git-annex.hs
@@ -13,10 +13,7 @@ import System.FilePath
import qualified GitAnnex
import qualified GitAnnexShell
#ifdef WITH_TESTSUITE
-#ifndef __WINDOWS__
import qualified Test
-#define CHECK_TEST
-#endif
#endif
main :: IO ()
@@ -28,7 +25,7 @@ main = run =<< getProgName
isshell n = takeFileName n == "git-annex-shell"
go a = do
ps <- getArgs
-#ifdef CHECK_TEST
+#ifdef WITH_TESTSUITE
if ps == ["test"]
then Test.main
else a ps