From fa62c3223383d8377d27576a0e32f7bfec0c826d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Aug 2019 11:11:55 -0400 Subject: [PATCH] Fix intermittent failure of the test suite Its repeated opening and writing to the sqlite database somehow caused inode cache information to occasionally be lost. This loses code coverage, since running git-annex as a child process prevents tracking what parts of the code are exercised. I have not looked at the code coverage in a long time. It would probably be possible to collect code coverage for the child procesess and merge it together. --- CHANGELOG | 3 ++ Test/Framework.hs | 39 +++++-------------- ...ld_for_neurodebian__58___test_failure.mdwn | 2 + 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a9a3dbd1e7..c4a708d4c4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,6 +28,9 @@ git-annex (7.20190731) UNRELEASED; urgency=medium of git-annex that omitted the hooks, you can simply re-run git-annex init to install them. * S3: Fix encoding when generating public urls of S3 objects. + * Fix intermittent failure of the test suite, where its repeated opening + and writing to the sqlite database somehow caused inode cache information + to occasionally be lost. -- Joey Hess Thu, 01 Aug 2019 00:11:56 -0400 diff --git a/Test/Framework.hs b/Test/Framework.hs index b50538d60f..bb5ca446c7 100644 --- a/Test/Framework.hs +++ b/Test/Framework.hs @@ -42,47 +42,26 @@ import qualified Utility.Exception import qualified Utility.ThreadScheduler import qualified Utility.Tmp.Dir import qualified Utility.Metered +import qualified Utility.SafeCommand import qualified Command.Uninit -import qualified CmdLine.GitAnnex as GitAnnex --- This is equivilant to running git-annex, but it's all run in-process --- so test coverage collection works. +-- Run git-annex. git_annex :: String -> [String] -> IO Bool -git_annex command params = git_annex' command params >>= \case - Right () -> return True - Left e -> do - hPutStrLn stderr (show e) - return False +git_annex command params = do + pp <- Annex.Path.programPath + Utility.SafeCommand.boolSystem pp $ + map Utility.SafeCommand.Param (command:params) -- For when git-annex is expected to fail. +-- Run with -q to squelch error. git_annex_shouldfail :: String -> [String] -> IO Bool -git_annex_shouldfail command params = git_annex' command ("-q":params) >>= \case - Right () -> return False - Left _ -> return True - -git_annex' :: String -> [String] -> IO (Either SomeException ()) -git_annex' command params = do - -- catch all errors, including normally fatal errors - try run ::IO (Either SomeException ()) - where - run = GitAnnex.run dummyTestOptParser - dummyTestRunner - dummyBenchmarkGenerator - (command:params) - dummyTestOptParser = pure mempty - dummyTestRunner _ = noop - dummyBenchmarkGenerator _ _ = return noop +git_annex_shouldfail command params = not <$> git_annex command ("-q":params) {- Runs git-annex and returns its output. -} git_annex_output :: String -> [String] -> IO String git_annex_output command params = do pp <- Annex.Path.programPath - got <- Utility.Process.readProcess pp (command:params) - -- Since the above is a separate process, code coverage stats are - -- not gathered for things run in it. - -- Run same command again, to get code coverage. - _ <- git_annex command params - return got + Utility.Process.readProcess pp (command:params) git_annex_expectoutput :: String -> [String] -> [String] -> IO () git_annex_expectoutput command params expected = do diff --git a/doc/bugs/fresh_build_for_neurodebian__58___test_failure.mdwn b/doc/bugs/fresh_build_for_neurodebian__58___test_failure.mdwn index 6f482509ec..c6da04ff11 100644 --- a/doc/bugs/fresh_build_for_neurodebian__58___test_failure.mdwn +++ b/doc/bugs/fresh_build_for_neurodebian__58___test_failure.mdwn @@ -31,3 +31,5 @@ FAIL (0.34s) I have tried to rebuild (`debian/rules binary`) second time while in the same environment -- didn't succeed... but then I proceeded to build amd64 fine, and redid i386 build just fine [[!meta author=yoh]] + +> [[fixed|done]] though w/o a true root cause analysis --[[Joey]]