hpc - ignore some expressions

Hi, I am generating code coverage reports using hpc, it works great. The reports would be much more helpful if I could somehow tell hpc to treat certain expressions as "covered" though. As an example, let's think of "impossible" cases of a function. f x | check x = result x | otherwise = error "impossible" I know there are techniques to get rid of (or minimise the number of) the impossible cases. I also can see how this information can be relevant, i.e. seeing whether `check` always holds or not in the report. However, at least for one version of the report, I want the error call like the above example to be treated as covered. Or maybe a different colour could be used to annotate "ignored"? Did anyone need/want anything like this? Is it possible? My guess is that this is somewhat possible using manually generated .tix files and merging them with the .tix file that is generated in the usual way. However this feels too adhoc, fragile and seems to be too much effort to reach a simple goal. Best, Ozgur

Ozgur Akgun
Hi, I am generating code coverage reports using hpc, it works great.
Hi Ozgur, Is this what you want? https://wiki.haskell.org/Haskell_program_coverage#Example. Dominic

On 23 February 2015 at 14:13, Dominic Steinitz
Ozgur Akgun
writes: Hi, I am generating code coverage reports using hpc, it works great.
Hi Ozgur,
Is this what you want? https://wiki.haskell.org/Haskell_program_coverage#Example.
That is sort of what I was getting at towards the end of my email:
My guess is that this is somewhat possible using manually generated .tix files and merging them with the .tix file that is generated in the usual way. However this feels too adhoc, fragile and seems to be too much effort to reach a simple goal.
Maybe I am not fully understanding how it works. Ozgur

Hi, I am generating code coverage reports using hpc, it works great.
Hi Ozgur,
Is this what you want? https://wiki.haskell.org/Haskell_program_coverage#Example.
That is sort of what I was getting at towards the end of my email:
My guess is that this is somewhat possible using manually generated .tix files and merging them with the .tix file that is generated in the usual way. However this feels too adhoc, fragile and seems to be too much effort to reach a simple goal.
Maybe I am not fully understanding how it works.
Ozgur
I think you are right about it being fragile and becoming a big overhead in maintenance. Maybe one could add some sort of annotation to the sources for which you wish to check coverage and also modify HPC to handle these?

On 23 February 2015 at 20:02, Dominic Steinitz
I think you are right about it being fragile and becoming a big overhead in maintenance. Maybe one could add some sort of annotation to the sources for which you wish to check coverage and also modify HPC to handle these?
A simple interface where the user provides a list of function names to be ignored would be a good start. Something like: hpc markup prog.tix --destdir=report --ignore=fail,error,impossible,undefined It _could_ also be a good idea to have a way of ignoring literals. Flags like --ignore-num-literals and --ignore-string-literals could treat all such literals as covered or ignored. Maybe I should put this as a feature request to the hpc maintainers. I am wondering if they maintain an issue tracker or not. The wiki pages for hpc aren't very helpful... (Starting from: https://wiki.haskell.org/GHC/HPC) Ozgur

Hi Ozgur,
I personally found the paper describing HPC to be quite descriptive.
See especially section 3.3 - it seems like it would be possible to
hack something up to remove entries containing "error" for example.
That being said, I can't find any reference to the program
"hpc-makemtix" aside from that paper. Maybe it got folded back into
hpc? Did you make any progress with this?
http://www.cs.york.ac.uk/plasma/publications/pdf/GillRuncimanHW07.pdf
On Mon, Feb 23, 2015 at 9:19 PM, Ozgur Akgun
On 23 February 2015 at 20:02, Dominic Steinitz
wrote: I think you are right about it being fragile and becoming a big overhead in maintenance. Maybe one could add some sort of annotation to the sources for which you wish to check coverage and also modify HPC to handle these?
A simple interface where the user provides a list of function names to be ignored would be a good start.
Something like:
hpc markup prog.tix --destdir=report --ignore=fail,error,impossible,undefined
It _could_ also be a good idea to have a way of ignoring literals. Flags like --ignore-num-literals and --ignore-string-literals could treat all such literals as covered or ignored.
Maybe I should put this as a feature request to the hpc maintainers. I am wondering if they maintain an issue tracker or not.
The wiki pages for hpc aren't very helpful...
(Starting from: https://wiki.haskell.org/GHC/HPC)
Ozgur
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Matthew,
I had also sent an email to the authors of that paper, Colin Runciman and
Andy Gill, and I did receive a prompt reply from them.
"hpc draft" seems to be the new name for "hpc-makemtix" and "hpc overlay"
seems to be "hpc-maketix".
Unfortunately, I couldn't get "hpc overlay" to work for my project and gave
up. It just kept crashing. I will probably revisit this later and try to
diagnose what the error actually was.
Hope this helps,
Ozgur
On 24 March 2015 at 17:56, Matthew Pickering
Hi Ozgur,
I personally found the paper describing HPC to be quite descriptive. See especially section 3.3 - it seems like it would be possible to hack something up to remove entries containing "error" for example. That being said, I can't find any reference to the program "hpc-makemtix" aside from that paper. Maybe it got folded back into hpc? Did you make any progress with this?
http://www.cs.york.ac.uk/plasma/publications/pdf/GillRuncimanHW07.pdf

On Mon, Feb 23, 2015 at 9:19 PM, Ozgur Akgun
wrote: Maybe I should put this as a feature request to the hpc maintainers. I am wondering if they maintain an issue tracker or not.
I don't have any answers to your questions, but just want to let you know that hpc uses the same issue tracker as GHC. There are currently 3 open tickets https://ghc.haskell.org/trac/ghc/query?status=!closed&component=Code+Coverage. Fixes for several long standing issues https://ghc.haskell.org/trac/ghc/query?status=closed&component=Code+Coverage&milestone=7.10.1&milestone=7.12.1 will be included in 7.10 and 7.12. If you find any more bugs, or indeed have a feature request, please report them. -Thomas
participants (4)
-
Dominic Steinitz
-
Matthew Pickering
-
Ozgur Akgun
-
Thomas Miedema