avoid running adjusted branch tests when git is too old

This commit is contained in:
Joey Hess 2019-08-15 13:54:05 -04:00
parent 708fc6567f
commit 007892739d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

18
Test.hs
View file

@ -62,6 +62,7 @@ import qualified Annex.Init
import qualified Annex.CatFile import qualified Annex.CatFile
import qualified Annex.Path import qualified Annex.Path
import qualified Annex.VectorClock import qualified Annex.VectorClock
import qualified Annex.AdjustedBranch
import qualified Annex.View import qualified Annex.View
import qualified Annex.View.ViewedFile import qualified Annex.View.ViewedFile
import qualified Logs.View import qualified Logs.View
@ -93,7 +94,7 @@ import qualified Types.Remote
optParser :: Parser TestOptions optParser :: Parser TestOptions
optParser = TestOptions optParser = TestOptions
<$> suiteOptionParser ingredients (tests False mempty) <$> suiteOptionParser ingredients (tests False True mempty)
<*> switch <*> switch
( long "keep-failures" ( long "keep-failures"
<> help "preserve repositories on test failure" <> help "preserve repositories on test failure"
@ -125,7 +126,8 @@ runner opts
runsubprocesstests (Just _) = isolateGitConfig $ do runsubprocesstests (Just _) = isolateGitConfig $ do
ensuretmpdir ensuretmpdir
crippledfilesystem <- fst <$> Annex.Init.probeCrippledFileSystem' tmpdir crippledfilesystem <- fst <$> Annex.Init.probeCrippledFileSystem' tmpdir
case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of adjustedbranchok <- Annex.AdjustedBranch.isGitVersionSupported
case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem adjustedbranchok opts) of
Nothing -> error "No tests found!?" Nothing -> error "No tests found!?"
Just act -> ifM act Just act -> ifM act
( exitSuccess ( exitSuccess
@ -141,12 +143,13 @@ ingredients =
, rerunningTests [consoleTestReporter] , rerunningTests [consoleTestReporter]
] ]
tests :: Bool -> TestOptions -> TestTree tests :: Bool -> Bool -> TestOptions -> TestTree
tests crippledfilesystem opts = testGroup "Tests" $ properties : tests crippledfilesystem adjustedbranchok opts =
map (\(d, te) -> withTestMode te initTests (unitTests d)) testmodes testGroup "Tests" $ properties :
map (\(d, te) -> withTestMode te initTests (unitTests d)) testmodes
where where
testmodes = catMaybes testmodes = catMaybes
[ Just ("v7 adjusted unlocked branch", (testMode opts (RepoVersion 7)) { adjustedUnlockedBranch = True }) [ canadjust ("v7 adjusted unlocked branch", (testMode opts (RepoVersion 7)) { adjustedUnlockedBranch = True })
, unlesscrippled ("v7 unlocked", (testMode opts (RepoVersion 7)) { unlockedFiles = True }) , unlesscrippled ("v7 unlocked", (testMode opts (RepoVersion 7)) { unlockedFiles = True })
, unlesscrippled ("v5", testMode opts (RepoVersion 5)) , unlesscrippled ("v5", testMode opts (RepoVersion 5))
, unlesscrippled ("v7 locked", testMode opts (RepoVersion 7)) , unlesscrippled ("v7 locked", testMode opts (RepoVersion 7))
@ -155,6 +158,9 @@ tests crippledfilesystem opts = testGroup "Tests" $ properties :
unlesscrippled v unlesscrippled v
| crippledfilesystem = Nothing | crippledfilesystem = Nothing
| otherwise = Just v | otherwise = Just v
canadjust v
| adjustedbranchok = Just v
| otherwise = Nothing
properties :: TestTree properties :: TestTree
properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck" properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck"