Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions test/Setup.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wall #-}

module Main (main) where
Expand Down Expand Up @@ -31,6 +32,10 @@ import Distribution.Types.TargetInfo
( targetComponent )
import Distribution.Types.UnqualComponentName
( unUnqualComponentName )
#if MIN_VERSION_Cabal(3,16,0)
import Distribution.Utils.Path
( SymbolicPathX, interpretSymbolicPathCWD)
#endif

-- directory
import System.Directory
Expand All @@ -45,6 +50,15 @@ import System.FilePath
main :: IO ()
main = defaultMainWithHooks testProcessHooks

#if MIN_VERSION_Cabal(3,16,0)
pathToString ::
SymbolicPathX allowAbsolute from to -> String
pathToString = interpretSymbolicPathCWD
#else
pathToString :: String -> String
pathToString = id
#endif

-- The following code works around Cabal bug #9854.
--
-- The process-tests package has an executable component named "cli-child",
Expand All @@ -57,7 +71,7 @@ testProcessHooks =
simpleUserHooks
{ buildHook = \ pd lbi userHooks buildFlags ->
withTestLBI pd lbi $ \ _testSuite clbi -> do
let pathsFile = autogenComponentModulesDir lbi clbi </> "Test" </> "Paths" <.> "hs"
let pathsFile = pathToString (autogenComponentModulesDir lbi clbi) </> "Test" </> "Paths" <.> "hs"
createDirectoryIfMissing True (takeDirectory pathsFile)
writeFile pathsFile $ unlines
[ "module Test.Paths where"
Expand All @@ -74,6 +88,6 @@ processInternalExes pd lbi =
, CExe exe <- [targetComponent tgt]
, let toolName = unUnqualComponentName $ exeName exe
toolLocation =
buildDir lbi
pathToString (buildDir lbi)
</> (toolName </> toolName <.> exeExtension (hostPlatform lbi))
]
2 changes: 1 addition & 1 deletion test/process-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ custom-setup
base >= 4.10 && < 4.23,
directory >= 1.1 && < 1.4,
filepath >= 1.2 && < 1.6,
Cabal >= 2.4 && < 3.14,
Cabal >= 2.4 && < 3.18,

-- Test executable for the CommunicationHandle functionality
executable cli-child
Expand Down
Loading