Skip to content

Commit b06a523

Browse files
committed
Fix #5713 Don't assume unified report redundant if only one *.tix file
Currently, `Stack.Coverage.generateHpcUnifiedReport` assumes that a unified coverage report will be redundant if there is only one `*.tix` file. However, that is not necessarily the case. For example, one package may test the library of another package that does not test its own library. As an interim solution, this proposed pull request suggests that a unified report should always be produced if there is one or more `*.tix` files, even if it may be redundant in some circumstances. A more complex solution would be to have a more complex test that determines whether a unified report would be truely redundant if there is only one `*.tix` file.
1 parent 9be49d0 commit b06a523

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Major changes:
1111

1212
Behavior changes:
1313

14+
* `stack build --coverage` will generate a unified coverage report, even if
15+
there is only one `*.tix` file, in case a package has tested the library of
16+
another package that has not tested its own library. See
17+
[#5713](https://github.com/commercialhaskell/stack/issues/5713)
18+
1419
Other enhancements:
1520

1621
Bug fixes:

src/Stack/Coverage.hs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,25 @@ generateHpcUnifiedReport = do
288288
extraTixFiles <- findExtraTixFiles
289289
let tixFiles = tixFiles0 ++ extraTixFiles
290290
reportDir = outputDir </> relDirCombined </> relDirAll
291-
if length tixFiles < 2
292-
then logInfo $
293-
(if null tixFiles then "No tix files" else "Only one tix file") <>
294-
" found in " <>
291+
-- Previously, the test below was:
292+
--
293+
-- if length tixFiles < 2
294+
-- then logInfo $
295+
-- (if null tixFiles then "No tix files" else "Only one tix file") <>
296+
-- " found in " <>
297+
-- fromString (toFilePath outputDir) <>
298+
-- ", so not generating a unified coverage report."
299+
-- else ...
300+
--
301+
-- However, a single *.tix file does not necessarily mean that a unified
302+
-- coverage report is redundant. For example, one package may test the library
303+
-- of another package that does not test its own library. See
304+
-- https://github.com/commercialhaskell/stack/issues/5713
305+
--
306+
-- As an interim solution, a unified coverage report will always be produced
307+
-- even if may be redundant in some circumstances.
308+
if null tixFiles
309+
then logInfo $ "No tix files found in " <>
295310
fromString (toFilePath outputDir) <>
296311
", so not generating a unified coverage report."
297312
else do

0 commit comments

Comments
 (0)