From 49a7727a99187c0c13d10b447d9f0db83212a955 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 16 Dec 2018 03:52:13 +0100 Subject: compile-test: Only override HOME when it doesn't exist --- tests/CompileTest.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') 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 () -- cgit v1.2.3