summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-23 21:47:11 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-23 21:51:21 +0200
commitb3ed032566f4e1ad7ea76a807a2ae54d08b38f31 (patch)
treee35caf822a18f5fd20eed3f5a562bc480d13da12 /src/Run.hs
parentc071c53a8fbbed9e5a66ba3e939909bf45296128 (diff)
Create test dir subdirectory for based on test name
Changelog: Create test dir subdirectory for given test that includes the test module and name.
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Run.hs b/src/Run.hs
index f3805ea..7dc5f5d 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -32,6 +32,7 @@ import Data.Text qualified as T
import Data.Typeable
import System.Directory
+import System.FilePath
import System.Exit
import System.IO.Error
import System.Posix.Process
@@ -58,7 +59,7 @@ import Test.Builtins
runTest :: Output -> TestOptions -> GlobalDefs -> Test -> IO Bool
runTest out opts gdefs test = do
- let testDir = optTestDir opts
+ let testDir = optTestDir opts </> T.unpack (textModuleName (testModuleName test) <> "." <> testName test)
when (optForce opts) $ removeDirectoryRecursive testDir `catchIOError` \e ->
if isDoesNotExistError e then return () else ioError e
exists <- doesPathExist testDir
@@ -81,6 +82,7 @@ runTest out opts gdefs test = do
{ teOutput = out
, teFailed = failedVar
, teOptions = opts
+ , teTestDir = testDir
, teNextObjId = objIdVar
, teNextProcId = procIdVar
, teProcesses = procVar
@@ -302,7 +304,7 @@ runStep = \case
withInternet :: (Network -> TestRun a) -> TestRun a
withInternet inner = do
- testDir <- asks $ optTestDir . teOptions . fst
+ testDir <- asks $ teTestDir . fst
inet <- newInternet testDir
flip finally (delInternet inet) $ do
withNetwork (inetRoot inet) $ \net -> do