summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-21 21:21:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-21 21:21:20 -0400
commit181d2ccd20a41b1785569acb3efb76deb8cbdf00 (patch)
tree3bcd69b2c31c3e4a1f428b906e58d61492c66c96 /Build
parentd2283777226d0e386a288ff224c71ce6ed2c1a0b (diff)
Improve detection of inability to check free disk space.
Don't check if configure indicated checks won't work. This should fix a FTBFS on mipsel, where configure correctly detects the checks won't work, while garbage is returned for disk space info at git-annex runtime. It also means that, when built via cabal, disk space checks are not enabled, unfortunatly.
Diffstat (limited to 'Build')
-rw-r--r--Build/Configure.hs17
-rw-r--r--Build/TestConfig.hs8
2 files changed, 22 insertions, 3 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs
index 341b8840d..14667ba86 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -10,8 +10,12 @@ import Control.Applicative
import Build.TestConfig
import Utility.SafeCommand
-tests :: [TestCase]
-tests =
+tests :: Bool -> [TestCase]
+tests True = cabaltests ++ common
+tests False = common
+
+common :: [TestCase]
+common =
[ TestCase "version" getVersion
, TestCase "git" $ requireCmd "git" "git --version >/dev/null"
, TestCase "git version" getGitVersion
@@ -28,6 +32,11 @@ tests =
, TestCase "ssh connection caching" getSshConnectionCaching
] ++ shaTestCases [1, 256, 512, 224, 384]
+cabaltests :: [TestCase]
+cabaltests =
+ [ TestCase "StatFS" testStatFSDummy
+ ]
+
shaTestCases :: [Int] -> [TestCase]
shaTestCases l = map make l
where make n =
@@ -72,6 +81,10 @@ getSshConnectionCaching :: Test
getSshConnectionCaching = Config "sshconnectioncaching" . BoolConfig <$>
boolSystem "sh" [Param "-c", Param "ssh -o ControlPersist=yes -V >/dev/null 2>/dev/null"]
+testStatFSDummy :: Test
+testStatFSDummy =
+ return $ Config "statfs_sanity_checked" $ MaybeBoolConfig Nothing
+
{- Set up cabal file with version. -}
cabalSetup :: IO ()
cabalSetup = do
diff --git a/Build/TestConfig.hs b/Build/TestConfig.hs
index e8a0d1336..0cc2019cf 100644
--- a/Build/TestConfig.hs
+++ b/Build/TestConfig.hs
@@ -10,7 +10,8 @@ type ConfigKey = String
data ConfigValue =
BoolConfig Bool |
StringConfig String |
- MaybeStringConfig (Maybe String)
+ MaybeStringConfig (Maybe String) |
+ MaybeBoolConfig (Maybe Bool)
data Config = Config ConfigKey ConfigValue
type Test = IO Config
@@ -21,6 +22,7 @@ instance Show ConfigValue where
show (BoolConfig b) = show b
show (StringConfig s) = show s
show (MaybeStringConfig s) = show s
+ show (MaybeBoolConfig s) = show s
instance Show Config where
show (Config key value) = unlines
@@ -31,6 +33,7 @@ instance Show Config where
valuetype (BoolConfig _) = "Bool"
valuetype (StringConfig _) = "String"
valuetype (MaybeStringConfig _) = "Maybe String"
+ valuetype (MaybeBoolConfig _) = "Maybe Bool"
writeSysConfig :: [Config] -> IO ()
writeSysConfig config = writeFile "Build/SysConfig.hs" body
@@ -109,6 +112,9 @@ testEnd (Config _ (BoolConfig False)) = status "no"
testEnd (Config _ (StringConfig s)) = status s
testEnd (Config _ (MaybeStringConfig (Just s))) = status s
testEnd (Config _ (MaybeStringConfig Nothing)) = status "not available"
+testEnd (Config _ (MaybeBoolConfig (Just True))) = status "yes"
+testEnd (Config _ (MaybeBoolConfig (Just False))) = status "no"
+testEnd (Config _ (MaybeBoolConfig Nothing)) = status "unknown"
status :: String -> IO ()
status s = putStrLn $ ' ':s