Thanks Thomas, that new flag is great.<div><br></div><div>Mike Craig<br><br>
<br><br><div class="gmail_quote">On Tue, Feb 7, 2012 at 10:03 PM, Thomas Tuegel <span dir="ltr"><<a href="mailto:ttuegel@gmail.com" target="_blank">ttuegel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Tue, Feb 7, 2012 at 3:23 PM, Austin Seipp <<a href="mailto:mad.one@gmail.com" target="_blank">mad.one@gmail.com</a>> wrote:<br>
</div><div>> If you're writing a library, you need to compile the library with<br>
> `-fhpc`, i.e. put it in the library stanza, not the testsuite stanza,<br>
> and then you can compile the test program using your library - the<br>
> resulting 'tix' file will contain the library coverage reports. You<br>
> can link a HPC-built library into an executable not compiled with HPC<br>
> just fine.<br>
><br>
> Normally I only compile the library under HPC mode, link it in a test,<br>
> and distribute the results from that. That way your coverage reports<br>
> don't include the test module (which may or may not be relevant.)<br>
><br>
> I normally add a cabal flag called 'hpc' which optionally enables<br>
> coverage reports for my library, e.g.<br>
><br>
> flag hpc<br>
> default: False<br>
><br>
> library<br>
> ...<br>
> ...<br>
> if flag(hpc)<br>
> ghc-options: -fhpc<br>
><br>
> Then when you want coverage reports, just say 'cabal install -fhpc<br>
> --enable-tests' and the resulting properties executable will spit out<br>
> the results when run.<br>
<br>
</div>First, as author of the test suite code, let me apologize for the<br>
terrible documentation.<br>
<br>
This is absolutely NOT how coverage reports are supposed to work. If<br>
you configure with '--enable-tests --enable-library-coverage', Cabal<br>
will take care of _everything_ else for you, including excluding the<br>
test module from the coverage report. You should not have to put any<br>
flag gymnastics in your .cabal file.<br>
<br>
If this doesn't work for you, please let me know, because it's a bug.<br>
<br>
Thanks!<br>
<span><font color="#888888"><br>
--<br>
Thomas Tuegel<br>
</font></span></blockquote></div><br>
</div>