diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2018-12-16 03:52:13 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-01-22 03:06:51 +0100 |
commit | 49a7727a99187c0c13d10b447d9f0db83212a955 (patch) | |
tree | 50ce87b1e9c8b1b2e43bf8dfa65913d4830f4772 | |
parent | e185208fe060fbd741a8083c33d16fba46acdc80 (diff) |
compile-test: Only override HOME when it doesn't exist
-rw-r--r-- | tests/CompileTest.hs | 11 |
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 () |