From 8779ad1be949e0ad050bbec1c10b2f7f7eec9239 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 May 2013 16:45:44 -0400 Subject: [PATCH] try building test suite on windows --- Test.hs | 14 +++++++++++--- git-annex.hs | 5 +---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Test.hs b/Test.hs index ce5fef3c7c..456443aff3 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 b8b05a27c9..0f45f53ebc 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