summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-11 19:34:28 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-11 19:34:28 -0400
commitcc7db6f058f69a1a0f08221f46d2d12d3d3764bf (patch)
tree080d6564d92ab622b4ad2dcf63a8315beab12fa5
parentcebee3740142484f2061ebe323fec7b0f45fbd4c (diff)
test fsck
-rw-r--r--test.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/test.hs b/test.hs
index 7e56fd65c..0c6e01884 100644
--- a/test.hs
+++ b/test.hs
@@ -30,6 +30,7 @@ import qualified GitAnnex
import qualified LocationLog
import qualified UUID
import qualified Remotes
+import qualified Core
main :: IO ()
main = do
@@ -68,6 +69,7 @@ toplevels = TestLabel "toplevel" $ TestList
, test_edit
, test_fix
, test_trust
+ , test_fsck
]
test_init :: Test
@@ -268,6 +270,20 @@ test_trust = "git-annex trust/untrust" ~: intmpclonerepo $ do
return $ elem u uuids
assertEqual "trust value" expected istrusted
+test_fsck :: Test
+test_fsck = "git-annex fsck" ~: intmpclonerepo $ do
+ git_annex "fsck" ["-q"] @? "fsck failed"
+ Utility.boolSystem "git" ["config", "annex.numcopies", "2"] @? "git config failed"
+ r <- git_annex "fsck" ["-q"]
+ not r @? "fsck failed to fail with numcopies unsatisfied"
+ Utility.boolSystem "git" ["config", "annex.numcopies", "1"] @? "git config failed"
+
+ git_annex "get" ["-q", annexedfile] @? "get of file failed"
+ Core.allowWrite annexedfile
+ writeFile annexedfile (changedcontent annexedfile)
+ r <- git_annex "fsck" ["-q"]
+ not r @? "fsck failed to fail with corrupted file content"
+
-- This is equivilant to running git-annex, but it's all run in-process
-- so test coverage collection works.
git_annex :: String -> [String] -> IO Bool