@@ -12,7 +12,7 @@ import Control.Monad
1212import Control.Monad.IO.Class
1313import Data.Bool (bool)
1414import Data.Function (fix)
15−import Data.Semigroup (Semigroup, (<>))
15+import Data.Semigroup ((<>))
1616import qualified Data.Set as Set
1717import Data.String
1818import Data.Text (Text)
@@ -49,13 +49,14 @@ data ObRunState
4949cp :: FilePath
5050cp = $(staticWhich "cp")
5151
52+cabalPath :: FilePath
53+cabalPath = $(staticWhich "cabal")
54+
55+gitUserConfig :: [Text]
56+gitUserConfig = ["-c", "user.name=Obelisk Selftest", "-c", "user.email=noreply@example.com"]
57+
5258commit :: Text -> Sh ()
53−commit msg = void $ run "git"
54− [ "-c"
55− , "user.name=Obelisk Selftest"
56− , "-c"
57− , "user.email=noreply@example.com"
58− , "commit"
59+commit msg = void $ run "git" $ gitUserConfig <> [ "commit"
5960 , "--no-gpg-sign"
6061 , "--allow-empty"
6162 , "-m"
@@ -113,14 +114,19 @@ main = do
113114 hspec $ parallel $ do
114115 let shelly_ = void . shellyOb verbosity
115116
116− inTmp :: (FilePath -> Sh a) -> IO ()
117− inTmp f = withTmp (chdir <*> f)
117+ defaultTmpDirName = "test λ"
118+
119+ inTmp' :: FilePath -> (FilePath -> Sh a) -> IO ()
120+ inTmp' dirname f = withTmp' dirname (chdir <*> f)
121+ inTmp = inTmp' defaultTmpDirName
118122
119− withTmp f = shelly_ . withSystemTempDirectory "test λ" $ f . fromString
123+ withTmp' dirname f = shelly_ . withSystemTempDirectory dirname $ f . fromString
124+ withTmp = withTmp' defaultTmpDirName
120125
121− inTmpObInit f = inTmp $ \dir -> do
126+ inTmpObInit' dirname f = inTmp' dirname $ \dir -> do
122127 run_ cp ["-rT", fromString initCache, toTextIgnore dir]
123128 f dir
129+ inTmpObInit = inTmpObInit' defaultTmpDirName
124130
125131 -- To be used in tests that change the obelisk impl directory
126132 inTmpObInitWithImplCopy f = inTmpObInit $ \dir ->
@@ -200,9 +206,12 @@ main = do
200206 forM_ ["ghc", "ghcjs"] $ \compiler -> do
201207 let
202208 shellName = "shells." <> compiler
203− inShell cmd' = run "nix-shell" ["default.nix", "-A", fromString shellName, "--run", cmd']
209+ inShell cmd' = run_ "nix-shell" ["default.nix", "-A", fromString shellName, "--run", cmd']
204210 it ("can enter " <> shellName) $ inTmpObInit $ \_ -> inShell "exit"
205− it ("can build in " <> shellName) $ inTmpObInit $ \_ -> inShell $ "cabal new-build --" <> fromString compiler <> " all"
211+ -- NOTE: We override the temporary directory name because cabal has a bug preventing new-build from working
212+ -- in a path that has unicode characters.
213+ it ("can build in " <> shellName) $ inTmpObInit' "test" $ \_ -> inShell $
214+ T.pack cabalPath <> " --version; " <> T.pack cabalPath <> " new-build --" <> T.pack compiler <> " all"
206215
207216 it "has idempotent thunk update" $ inTmpObInitWithImplCopy $ \_ -> do
208217 _ <- pack
@@ -308,7 +317,7 @@ testThunkPack path' = withTempFile (T.unpack $ toTextIgnore path') "test-file" $
308317 liftIO $ T.hPutStrLn handle "test file" >> hClose handle
309318 ensureThunkPackFails "modified"
310319 -- Existing stashes
311− void $ git ["stash"]
320+ void $ git $ gitUserConfig <> [ "stash" ]
312321 ensureThunkPackFails "has stashes"
313322
314323-- | Blocks until a non-empty line is available