Skip to content

Commit 61ae8db

Browse files
committed
Clean up coverage tix file path code
1 parent 7cd791e commit 61ae8db

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/Stack/Build/Execute.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,10 @@ singleTest runInBase topts testsToRun ac ee task installedMap = do
11941194
C.TestSuiteExeV10{} -> return (stestName, False)
11951195
interface -> throwM (TestSuiteTypeUnsupported interface)
11961196

1197-
exeName <- testExeName testName'
1197+
let exeName = testName' ++
1198+
case configPlatform config of
1199+
Platform _ Windows -> ".exe"
1200+
_ -> ""
11981201
tixPath <- liftM (pkgDir </>) $ parseRelFile $ exeName ++ ".tix"
11991202
exePath <- liftM (buildDir </>) $ parseRelFile $ "build/" ++ testName' ++ "/" ++ exeName
12001203
exists <- fileExists exePath

src/Stack/Coverage.hs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
module Stack.Coverage
99
( deleteHpcReports
1010
, updateTixFile
11-
, testExeName
1211
, generateHpcReport
1312
, HpcReportOpts(..)
1413
, generateHpcReportForTargets
@@ -28,7 +27,6 @@ import qualified Data.ByteString.Char8 as S8
2827
import Data.Foldable (forM_, asum, toList)
2928
import Data.Function
3029
import Data.List
31-
import Data.List.Extra (stripSuffix)
3230
import qualified Data.Map.Strict as Map
3331
import Data.Maybe
3432
import Data.Maybe.Extra (mapMaybeM)
@@ -39,7 +37,6 @@ import qualified Data.Text.Encoding as T
3937
import qualified Data.Text.IO as T
4038
import qualified Data.Text.Lazy as LT
4139
import Data.Traversable (forM)
42-
import Distribution.System (OS (Windows), Platform (Platform))
4340
import Network.HTTP.Download (HasHttpManager)
4441
import Path
4542
import Path.Extra (toFilePathNoTrailingSep)
@@ -82,15 +79,6 @@ updateTixFile pkgName tixSrc testName = do
8279
liftIO $ writeTix (toFilePath tixDest) (removeExeModules tix)
8380
removeFileIfExists tixSrc
8481

85-
testExeName :: (MonadReader env m,HasConfig env) => String -> m String
86-
testExeName testName = do
87-
config <- asks getConfig
88-
let exeExtension =
89-
case configPlatform config of
90-
Platform _ Windows -> ".exe"
91-
_ -> ""
92-
return $ testName ++ exeExtension
93-
9482
-- | Get the directory used for hpc reports for the given pkgId.
9583
hpcPkgPath :: (MonadIO m,MonadReader env m,HasConfig env,MonadLogger m,MonadBaseControl IO m,MonadCatch m,HasEnvConfig env)
9684
=> PackageName -> m (Path Abs Dir)
@@ -105,8 +93,7 @@ tixFilePath :: (MonadIO m,MonadReader env m,HasConfig env,MonadLogger m,MonadBas
10593
=> PackageName -> String -> m (Path Abs File)
10694
tixFilePath pkgName testName = do
10795
pkgPath <- hpcPkgPath pkgName
108-
exeName <- testExeName testName
109-
tixRel <- parseRelFile (testName ++ "/" ++ exeName ++ ".tix")
96+
tixRel <- parseRelFile (testName ++ "/" ++ testName ++ ".tix")
11097
return (pkgPath </> tixRel)
11198

11299
-- | Generates the HTML coverage report and shows a textual coverage summary for a package.

0 commit comments

Comments
 (0)