Problems with Haskell Program Coverage

I want to use hpc to check that the ASN.1 library tests cover all the code. When I run it with a set of tests that I *know* don't test certain things, it reports that they have been covered i.e. there are not coloured in the markup that hpc produces. I would have expected a lot of yellow. It seems to work ok on small amounts of code so I'm not clear what I'm doing wrong. I'd be happy to provide the .tix file or put the .html files somewhere if that would be helpful. Here's what I use: ghc -o NewTest NewTest.hs -fhpc --make NewTest hpc markup NewTest Dominic.

Dominic Steinitz
I want to use hpc to check that the ASN.1 library tests cover all the code. When I run it with a set of tests that I *know* don't test certain things, it reports that they have been covered i.e. there are not coloured in the markup that hpc produces. I would have expected a lot of yellow.
The record of coverage is cumulative across multiple runs. Is it possible that you did not remove an old .tix file before running the tests? Regards, Malcolm

Malcolm Wallace
Dominic Steinitz
wrote: I want to use hpc to check that the ASN.1 library tests cover all the code. When I run it with a set of tests that I *know* don't test certain things, it reports that they have been covered i.e. there are not coloured in the markup that hpc produces. I would have expected a lot of yellow.
The record of coverage is cumulative across multiple runs. Is it possible that you did not remove an old .tix file before running the tests?
Thanks for your reply I was beginning to worry I might be the only person trying to use this. I've done a bit of investigation and it seems there are at least two problems: 1. I have literate haskell files (.lhs). 2. Even if I run them through the pre-processor (ghc -E) they still don't work but if I manually remove these lines (which seem to get inserted by the pre-processor) {-# LINE 1 "ASNTYPE.lhs" #-} #line 1 "ASNTYPE.lhs" then it does actually work. It looks like a bug to me. I guess I should report it on the ghc trac. I still have a problem with another project which doesn't use literate haskell but does require the use of -cpp and has got #ifdef's. I haven't got to the bottom of it yet but I'm suspicious that lines starting with # cause hpc to misbehave. It's strange that hpc should behave like this as I would have thought it wouldn't care about hs / lhs and # as ghc would have done some of its standard processing before hpc got engaged. Dominic. hpc_index.html

dominic:
Malcolm Wallace
writes: Dominic Steinitz
wrote: I want to use hpc to check that the ASN.1 library tests cover all the code. When I run it with a set of tests that I *know* don't test certain things, it reports that they have been covered i.e. there are not coloured in the markup that hpc produces. I would have expected a lot of yellow.
The record of coverage is cumulative across multiple runs. Is it possible that you did not remove an old .tix file before running the tests?
Thanks for your reply I was beginning to worry I might be the only person trying to use this.
I've used it a *lot*.
I've done a bit of investigation and it seems there are at least two problems:
1. I have literate haskell files (.lhs).
2. Even if I run them through the pre-processor (ghc -E) they still don't work but if I manually remove these lines (which seem to get inserted by the pre-processor)
{-# LINE 1 "ASNTYPE.lhs" #-} #line 1 "ASNTYPE.lhs"
then it does actually work.
It looks like a bug to me. I guess I should report it on the ghc trac.
Ah, I think this is a known issue with .lhs (or with preprocessors), not handling source locations properly (?). Contact Andy. -- Don
participants (4)
-
Dominic Steinitz
-
Dominic Steinitz
-
Don Stewart
-
Malcolm Wallace