Opened 6 years ago

Closed 8 months ago

#3191 closed bug (worksforme)

hpc reports spurious results with .lhs files even after processing with ghc -E

Reported by: dominic Owned by: andy@…
Priority: lowest Milestone: 7.10.1
Component: Code Coverage Version: 6.10.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I've done a bit of investigation and it seems there are at least two problems:

  1. I have literate haskell files (.lhs).
  1. 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.

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.

This happens on linux and windows (not surprisingly).

Change History (12)

comment:1 Changed 6 years ago by igloo

  • difficulty set to Unknown

See also #2991.

comment:2 Changed 6 years ago by igloo

  • Milestone set to 6.12 branch

comment:3 Changed 5 years ago by igloo

  • Milestone changed from 6.12 branch to 6.12.3

comment:4 Changed 5 years ago by igloo

  • Milestone changed from 6.12.3 to 6.14.1
  • Priority changed from normal to low

comment:5 Changed 5 years ago by igloo

  • Milestone changed from 7.0.1 to 7.0.2

comment:6 Changed 4 years ago by igloo

  • Milestone changed from 7.0.2 to 7.2.1

comment:7 Changed 4 years ago by igloo

  • Milestone changed from 7.2.1 to 7.4.1

comment:8 Changed 3 years ago by igloo

  • Milestone changed from 7.4.1 to 7.6.1
  • Priority changed from low to lowest

comment:9 Changed 3 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:10 Changed 13 months ago by thoughtpolice

  • Milestone changed from 7.6.2 to 7.10.1

Moving to 7.10.1.

comment:11 Changed 8 months ago by thomie

  • Status changed from new to infoneeded
  • Type of failure set to None/Unknown

I cannot reproduce your problem, or I don't understand the problem description.

Even if I run them through the pre-processor (ghc -E) they still don't work

What doesn't work? Do you see an error message, or maybe nothing happens at all? What are you trying to do?

Please attach a small test program + instructions that demonstrate your problem.

Here are some things I tried (same result with 7.8.3 as with 6.12.3):

$ cat test.lhs 
> main = print "ok"

$ ghc -E test.lhs

$ cat test.hspp                    # The 2 inserted lines you mention
{-# LINE 1 "test.lhs" #-}
#line 1 "test.lhs"
  main = print "ok"

$ ghc -fhpc -o test test.hspp

$ ./test
"ok"

$ hpc report test
100% expressions used (0/0)
100% boolean coverage (0/0)
     100% guards (0/0)
     100% 'if' conditions (0/0)
     100% qualifiers (0/0)
100% alternatives used (0/0)
100% local declarations used (0/0)
100% top-level declarations used (0/0)

# Looks ok to me.

comment:12 Changed 8 months ago by dominic

  • Resolution set to worksforme
  • Status changed from infoneeded to closed

Thanks for looking at this. I had completely forgotten about this not surprisingly as it is 6 years old. I no longer have access to ghc 6.12.3 and if you can't reproduce then I am going to close it. I can always open a new ticket if need be.

Note: See TracTickets for help on using tickets.