Skip to content

Commit

Permalink
Multiple test-suites with --coverage (WIP)
Browse files Browse the repository at this point in the history
Unfortunately, this doesn't quite work right yet, because ".mix" files
from the different test suites end up overwriting eachother.
  • Loading branch information
mgsloan committed Jul 9, 2015
1 parent 9d252c6 commit 66deefa
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ singleTest topts ac ee task =
-- directory. Since the hpc program only takes one specification for "--hpcdir", this must be
-- the same for all packages (something which is currently true).
subdir <- stripDir pkgDir (hpcDir </> dotHpc)
generateHpcReport hpcDir subdir tixes
mapM_ (generateHpcReport hpcDir subdir . toFilePath . filename) tixes

bs <- liftIO $
case mlogFile of
Expand Down Expand Up @@ -851,26 +851,29 @@ compareTestsComponents comps tests2 =
("test", y) -> Set.singleton $ T.drop 1 y
_ -> Set.empty

-- | Generate the HTML report and textual report.
-- | Generate the HTML report and show textual coverage summary.
generateHpcReport
:: M env m
=> Path Abs Dir -> Path Rel Dir -> [Path Abs File] -> m ()
=> Path Abs Dir -> Path Rel Dir -> String -> m ()
generateHpcReport _ _ [] = return ()
generateHpcReport hpcDir subdir tixes = do
generateHpcReport hpcDir subdir tixName = do
pkgDirs <- Map.keys . bcPackages <$> asks getBuildConfig
let args = concat
[ map (toFilePath . filename) tixes
outputSubdir <- parseRelDir (FP.dropExtension tixName)
let outputDir = hpcDir </> outputSubdir
args = concat
[ [tixName]
, concatMap (\x -> ["--srcdir", toFilePath x]) pkgDirs
, ["--hpcdir", toFilePath subdir]]
, ["--hpcdir", toFilePath subdir, "--reset-hpcdirs"]]
markupArgs = "--destdir" : toFilePath outputDir : args
menv <- getMinimalEnvOverride
$logInfo "Generating HPC HTML ..."
_ <- readProcessStdout (Just hpcDir) menv "hpc" ("markup" : args)
_ <- readProcessStdout (Just hpcDir) menv "hpc" ("markup" : markupArgs)
output <-
readProcessStdout (Just hpcDir) menv "hpc" ("report" : args)
forM_ (S8.lines output) ($logInfo . T.decodeUtf8)
$logInfo
("The HTML report is available at " <>
T.pack (toFilePath (hpcDir </> $(mkRelFile "hpc_index.html"))))
T.pack (toFilePath (outputDir </> $(mkRelFile "hpc_index.html"))))

singleBench :: M env m
=> BenchmarkOpts
Expand Down

0 comments on commit 66deefa

Please sign in to comment.