remove leftovers from removed TestSuite build flag

Test suite is always built, so this can be simplified.
This commit is contained in:
Joey Hess 2018-11-19 12:39:16 -04:00
parent 1f9f220816
commit 83109affd1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 15 additions and 19 deletions

View file

@ -123,7 +123,7 @@ import qualified Command.TestRemote
import qualified Command.Benchmark
#endif
cmds :: Parser TestOptions -> Maybe TestRunner -> [Command]
cmds :: Parser TestOptions -> TestRunner -> [Command]
cmds testoptparser testrunner =
[ Command.Help.cmd
, Command.Add.cmd
@ -233,7 +233,7 @@ cmds testoptparser testrunner =
#endif
]
run :: Parser TestOptions -> Maybe TestRunner -> [String] -> IO ()
run :: Parser TestOptions -> TestRunner -> [String] -> IO ()
run testoptparser testrunner args = go envmodes
where
go [] = dispatch True args

View file

@ -10,21 +10,20 @@ module Command.Test where
import Command
import Types.Test
cmd :: Parser TestOptions -> Maybe TestRunner -> Command
cmd :: Parser TestOptions -> TestRunner -> Command
cmd optparser runner = noRepo (startIO runner <$$> const optparser) $
dontCheck repoExists $
command "test" SectionTesting
"run built-in test suite"
paramNothing (seek runner <$$> const optparser)
seek :: Maybe TestRunner -> TestOptions -> CommandSeek
seek :: TestRunner -> TestOptions -> CommandSeek
seek runner o = commandAction $ start runner o
start :: Maybe TestRunner -> TestOptions -> CommandStart
start :: TestRunner -> TestOptions -> CommandStart
start runner o = do
liftIO $ startIO runner o
stop
startIO :: Maybe TestRunner -> TestOptions -> IO ()
startIO Nothing _ = warningIO "git-annex was built without its test suite; not testing"
startIO (Just runner) o = runner o
startIO :: TestRunner -> TestOptions -> IO ()
startIO runner o = runner o

17
Test.hs
View file

@ -103,28 +103,25 @@ optParser = TestOptions
)
<*> cmdParams "non-options are for internal use only"
runner :: Maybe (TestOptions -> IO ())
runner = Just go
runner :: TestOptions -> IO ()
runner opts
| fakeSsh opts = runFakeSsh (internalData opts)
| otherwise = runsubprocesstests =<< Utility.Env.getEnv subenv
where
go opts
| fakeSsh opts = runFakeSsh (internalData opts)
| otherwise = runsubprocesstests opts
=<< Utility.Env.getEnv subenv
-- Run git-annex test in a subprocess, so that any files
-- it may open will be closed before running finalCleanup.
-- This should prevent most failures to clean up after the test
-- suite.
subenv = "GIT_ANNEX_TEST_SUBPROCESS"
runsubprocesstests opts Nothing = do
runsubprocesstests Nothing = do
pp <- Annex.Path.programPath
Utility.Env.Set.setEnv subenv "1" True
ps <- getArgs
(Nothing, Nothing, Nothing, pid) <-createProcess (proc pp ps)
(Nothing, Nothing, Nothing, pid) <- createProcess (proc pp ps)
exitcode <- waitForProcess pid
unless (keepFailuresOption opts) finalCleanup
exitWith exitcode
runsubprocesstests opts (Just _) = isolateGitConfig $ do
runsubprocesstests (Just _) = isolateGitConfig $ do
ensuretmpdir
crippledfilesystem <- fst <$> Annex.Init.probeCrippledFileSystem' tmpdir
case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of

View file

@ -65,7 +65,7 @@ git_annex' command params = do
-- catch all errors, including normally fatal errors
try run ::IO (Either SomeException ())
where
run = GitAnnex.run dummyTestOptParser Nothing (command:"-q":params)
run = GitAnnex.run dummyTestOptParser (\_ -> noop) (command:"-q":params)
dummyTestOptParser = pure mempty
{- Runs git-annex and returns its output. -}