diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-21 14:20:41 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-21 14:20:41 -0400 |
commit | a76b13b848612595a254025f3eb415c2395a92de (patch) | |
tree | 3cef41326b185ef361f327ddf4a88c6f1ee3e460 | |
parent | 57235315c4dcab9d2271adcca94aba610b5ed0c5 (diff) |
test fsck in bare repos (75%)
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | test.hs | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/debian/changelog b/debian/changelog index 59c6392fe..62c7d40f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,7 @@ git-annex (3.20111212) UNRELEASED; urgency=low * Properly handle multiline git config values. * Fix the hook special remote, which bitrotted a while ago. * map: --fast disables use of dot to display map - * Test suite improvements. Current top-level test coverage: 74% + * Test suite improvements. Current top-level test coverage: 75% -- Joey Hess <joeyh@debian.org> Mon, 12 Dec 2011 01:57:49 -0400 @@ -388,7 +388,7 @@ test_trust = "git-annex trust/untrust/semitrust/dead" ~: intmpclonerepo $ do assertBool msg present test_fsck :: Test -test_fsck = "git-annex fsck" ~: TestList [basicfsck, withlocaluntrusted, withremoteuntrusted] +test_fsck = "git-annex fsck" ~: TestList [basicfsck, barefsck, withlocaluntrusted, withremoteuntrusted] where basicfsck = TestCase $ intmpclonerepo $ do git_annex "fsck" [] @? "fsck failed" @@ -397,6 +397,8 @@ test_fsck = "git-annex fsck" ~: TestList [basicfsck, withlocaluntrusted, withrem boolSystem "git" [Params "config annex.numcopies 1"] @? "git config failed" corrupt annexedfile corrupt sha1annexedfile + barefsck = TestCase $ intmpbareclonerepo $ do + git_annex "fsck" [] @? "fsck failed" withlocaluntrusted = TestCase $ intmpclonerepo $ do git_annex "get" [annexedfile] @? "get failed" git_annex "untrust" ["origin"] @? "untrust of origin repo failed" @@ -735,10 +737,13 @@ inmainrepo :: Assertion -> Assertion inmainrepo a = indir mainrepodir a intmpclonerepo :: Assertion -> Assertion -intmpclonerepo a = withtmpclonerepo $ \r -> indir r a +intmpclonerepo a = withtmpclonerepo False $ \r -> indir r a + +intmpbareclonerepo :: Assertion -> Assertion +intmpbareclonerepo a = withtmpclonerepo True $ \r -> indir r a -withtmpclonerepo :: (FilePath -> Assertion) -> Assertion -withtmpclonerepo = bracket (clonerepo mainrepodir tmprepodir) cleanup +withtmpclonerepo :: Bool -> (FilePath -> Assertion) -> Assertion +withtmpclonerepo bare = bracket (clonerepo mainrepodir tmprepodir bare) cleanup withgitrepo :: (FilePath -> Assertion) -> Assertion withgitrepo = bracket (setuprepo mainrepodir) return @@ -766,11 +771,12 @@ setuprepo dir = do return dir -- clones are always done as local clones; we cannot test ssh clones -clonerepo :: FilePath -> FilePath -> IO FilePath -clonerepo old new = do +clonerepo :: FilePath -> FilePath -> Bool -> IO FilePath +clonerepo old new bare = do cleanup new ensuretmpdir - boolSystem "git" [Params "clone -q", File old, File new] @? "git clone failed" + let b = if bare then " --bare" else "" + boolSystem "git" [Params ("clone -q" ++ b), File old, File new] @? "git clone failed" indir new $ git_annex "init" ["-q", new] @? "git annex init failed" return new |