aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CompileTest.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs
index 33254b2..9359260 100644
--- a/tests/CompileTest.hs
+++ b/tests/CompileTest.hs
@@ -39,10 +39,19 @@ withinRange'CH v r =
setupHOME :: IO ()
setupHOME = do
+ mhome <- lookupEnv "HOME"
+ case mhome of
+ Just home -> do
+ exists <- doesDirectoryExist home
+ when (not exists) createHOME
+ Nothing -> createHOME
+
+createHOME :: IO ()
+createHOME = do
tmp <- fromMaybe "/tmp" <$> lookupEnv "TMPDIR"
let home = tmp </> "compile-test-home"
_ <- rawSystem "rm" ["-r", home]
- createDirectory home
+ createDirectory home
setEnv "HOME" home
main :: IO ()