Commit 539bc160 authored by Duncan Coutts's avatar Duncan Coutts Committed by Alexis Williams
Browse files

Attempt to fix VCS tests on Windows

On Windows, file locks held by programs we run (in this case VCSs) are
not always released prior to completing process termination! Obviously
this is total madness since we can't know what files the child process
had locks on, and so we cannot wait for those locks to be released.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365202.aspx

This means we run into stale locks when trying to delete the test
directory. There is no sane way to wait on those locks being
released, we just have to wait and hope. Lets hope 1 second is enough.
parent 31af8e27
...@@ -28,6 +28,7 @@ import System.IO ...@@ -28,6 +28,7 @@ import System.IO
import System.FilePath import System.FilePath
import System.Directory import System.Directory
import System.Random import System.Random
import qualified System.Info (os)
import Test.Tasty import Test.Tasty
import Test.Tasty.QuickCheck import Test.Tasty.QuickCheck
...@@ -137,7 +138,17 @@ testSetup vcs mkVCSTestDriver repoRecipe theTest = do ...@@ -137,7 +138,17 @@ testSetup vcs mkVCSTestDriver repoRecipe theTest = do
repoState <- createRepo vcsDriver repoRecipe repoState <- createRepo vcsDriver repoRecipe
-- actual test -- actual test
theTest vcsDriver tmpdir repoState result <- theTest vcsDriver tmpdir repoState
-- On Windows, file locks held by programs we run (in this case VCSs)
-- are not always released prior to completing process termination! (WTF!)
-- https://msdn.microsoft.com/en-us/library/windows/desktop/aa365202.aspx
-- This means we run into stale locks when trying to delete the test
-- directory. There is no sane way to wait on those locks being released,
-- we just have to wait and hope. Lets hope 1 second is enough.
when isWindows $ threadDelay 1000000
return result
where where
verbosity = silent verbosity = silent
...@@ -701,3 +712,6 @@ withTestDir action = do ...@@ -701,3 +712,6 @@ withTestDir action = do
where where
verbosity = silent verbosity = silent
isWindows :: Bool
isWindows = System.Info.os == "mingw32"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment