100% pass on FAT

This commit is contained in:
Joey Hess 2016-02-16 16:02:54 -04:00
parent aa569500d5
commit 7db739f6c4
Failed to extract signature

63
Test.hs
View file

@ -134,15 +134,13 @@ tests crippledfilesystem opts = testGroup "Tests" $ properties :
where where
testmodes = catMaybes testmodes = catMaybes
[ Just ("v6 unlocked", (testMode opts "6") { unlockedFiles = True }) [ Just ("v6 unlocked", (testMode opts "6") { unlockedFiles = True })
, Just ("v5", testMode opts "5") , unlesscrippled ("v5", testMode opts "5")
, if crippledfilesystem , unlesscrippled ("v6 locked", testMode opts "6")
then Nothing
else Just ("v6 locked", testMode opts "6")
#ifndef mingw32_HOST_OS
-- Windows will only use direct mode, so don't test twice.
, Just ("v5 direct", (testMode opts "5") { forceDirect = True }) , Just ("v5 direct", (testMode opts "5") { forceDirect = True })
#endif
] ]
unlesscrippled v
| crippledfilesystem = Nothing
| otherwise = Just v
properties :: TestTree properties :: TestTree
properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck" properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck"
@ -830,16 +828,20 @@ test_unused = intmpclonerepoInDirect $ do
checkunused [] "after dropunused" checkunused [] "after dropunused"
not <$> git_annex "dropunused" ["--force", "10", "501"] @? "dropunused failed to fail on bogus numbers" not <$> git_annex "dropunused" ["--force", "10", "501"] @? "dropunused failed to fail on bogus numbers"
-- unused used to miss renamed symlinks that were not staged -- Unused used to miss renamed symlinks that were not staged
-- and pointed at annexed content, and think that content was unused -- and pointed at annexed content, and think that content was unused.
writeFile "unusedfile" "unusedcontent" -- This is only relevant when using locked files; if the file is
git_annex "add" ["unusedfile"] @? "add of unusedfile failed" -- unlocked, the work tree file has the content, and there's no way
unusedfilekey <- getKey backendSHA256E "unusedfile" -- to associate it with the key.
renameFile "unusedfile" "unusedunstagedfile" unlessM (unlockedFiles <$> getTestMode) $ do
boolSystem "git" [Param "rm", Param "-qf", File "unusedfile"] @? "git rm failed" writeFile "unusedfile" "unusedcontent"
checkunused [] "with unstaged link" git_annex "add" ["unusedfile"] @? "add of unusedfile failed"
removeFile "unusedunstagedfile" unusedfilekey <- getKey backendSHA256E "unusedfile"
checkunused [unusedfilekey] "with renamed link deleted" renameFile "unusedfile" "unusedunstagedfile"
boolSystem "git" [Param "rm", Param "-qf", File "unusedfile"] @? "git rm failed"
checkunused [] "with unstaged link"
removeFile "unusedunstagedfile"
checkunused [unusedfilekey] "with renamed link deleted"
-- unused used to miss symlinks that were deleted or modified -- unused used to miss symlinks that were deleted or modified
-- manually -- manually
@ -1765,16 +1767,17 @@ cleanup' final dir = whenM (doesDirectoryExist dir) $ do
removeDirectoryRecursive dir removeDirectoryRecursive dir
checklink :: FilePath -> Assertion checklink :: FilePath -> Assertion
checklink f = ifM (annexeval Config.crippledFileSystem) checklink f =
( (isJust <$> annexeval (Annex.Link.getAnnexLinkTarget f)) -- in direct mode, it may be a symlink, or not, depending
@? f ++ " is not a (crippled) symlink" -- on whether the content is present.
, do unlessM (annexeval Config.isDirect) $
s <- getSymbolicLinkStatus f ifM (annexeval Config.crippledFileSystem)
-- in direct mode, it may be a symlink, or not, depending ( (isJust <$> annexeval (Annex.Link.getAnnexLinkTarget f))
-- on whether the content is present. @? f ++ " is not a (crippled) symlink"
unlessM (annexeval Config.isDirect) $ , do
isSymbolicLink s @? f ++ " is not a symlink" s <- getSymbolicLinkStatus f
) isSymbolicLink s @? f ++ " is not a symlink"
)
checkregularfile :: FilePath -> Assertion checkregularfile :: FilePath -> Assertion
checkregularfile f = do checkregularfile f = do
@ -1876,8 +1879,10 @@ annexed_present f = ifM (unlockedFiles <$> getTestMode)
) )
annexed_present_locked :: FilePath -> Assertion annexed_present_locked :: FilePath -> Assertion
annexed_present_locked = runchecks annexed_present_locked f = ifM (annexeval Config.crippledFileSystem)
[checklink, checkcontent, checkunwritable, inlocationlog] ( runchecks [checklink, inlocationlog] f
, runchecks [checklink, checkcontent, checkunwritable, inlocationlog] f
)
annexed_present_unlocked :: FilePath -> Assertion annexed_present_unlocked :: FilePath -> Assertion
annexed_present_unlocked = runchecks annexed_present_unlocked = runchecks