try building test suite on windows

This commit is contained in:
Joey Hess 2013-05-17 16:45:44 -04:00
parent 1e7682cf0d
commit 8779ad1be9
2 changed files with 12 additions and 7 deletions

14
Test.hs
View file

@ -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.

View file

@ -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