summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-08 16:14:39 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-08 16:14:39 -0400
commitfa88037c46b3d7094e854397b954b478cf246caa (patch)
treee952e0411f18d7fada9effb4ef0187bee68fbd10
parent3faf5f105c84689c766933dd89826ec6961cf100 (diff)
defer deletion of test repos until end, fixes sqlite crash
The crash turned out to be caused by the sqlite database being deleted out from under sqlite before it was done with it. Since multiple git_annex calls are done in the same process while running the test suite, the DbHandle could linger until GCed, and the test repo, and thus sqlite database be deleted before the workerThread was done.
-rw-r--r--Test.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/Test.hs b/Test.hs
index f7f0203c7..c8a0f4772 100644
--- a/Test.hs
+++ b/Test.hs
@@ -1631,15 +1631,12 @@ withtmpclonerepo' cfg a = do
clone <- clonerepo mainrepodir dir cfg
r <- tryNonAsync (a clone)
case r of
- Right () -> cleanup clone
+ Right () -> return ()
Left e -> do
- ifM (keepFailures <$> getTestMode)
- ( putStrLn $ "** Preserving repo for failure analysis in " ++ clone
- , cleanup clone
- )
+ whenM (keepFailures <$> getTestMode) $
+ putStrLn $ "** Preserving repo for failure analysis in " ++ clone
throwM e
-
disconnectOrigin :: Assertion
disconnectOrigin = boolSystem "git" [Param "remote", Param "rm", Param "origin"] @? "remote rm"