{"action":"created","issue":{"url":"https://api.github.com/repos/haskell/cabal/issues/3682","repository_url":"https://api.github.com/repos/haskell/cabal","labels_url":"https://api.github.com/repos/haskell/cabal/issues/3682/labels{/name}","comments_url":"https://api.github.com/repos/haskell/cabal/issues/3682/comments","events_url":"https://api.github.com/repos/haskell/cabal/issues/3682/events","html_url":"https://github.com/haskell/cabal/issues/3682","id":169971242,"number":3682,"title":"The --enable-coverage flag doesn't work","user":{"login":"mightybyte","id":9451,"avatar_url":"https://avatars.githubusercontent.com/u/9451?v=3","gravatar_id":"","url":"https://api.github.com/users/mightybyte","html_url":"https://github.com/mightybyte","followers_url":"https://api.github.com/users/mightybyte/followers","following_url":"https://api.github.com/users/mightybyte/following{/other_user}","gists_url":"https://api.github.com/users/mightybyte/gists{/gist_id}","starred_url":"https://api.github.com/users/mightybyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mightybyte/subscriptions","organizations_url":"https://api.github.com/users/mightybyte/orgs","repos_url":"https://api.github.com/users/mightybyte/repos","events_url":"https://api.github.com/users/mightybyte/events{/privacy}","received_events_url":"https://api.github.com/users/mightybyte/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/haskell/cabal/labels/type:%20bug","name":"type: bug","color":"e99695"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-08T16:52:08Z","updated_at":"2016-08-08T18:33:32Z","closed_at":null,"body":"To reproduce this, first clone this repo:\r\n\r\n    git clone https://github.com/mightybyte/map-syntax.git\r\n\r\nThen the following inside the map-syntax repo generates nice HPC test coverage reports:\r\n\r\n    git checkout hpc-works\r\n    cabal install --enable-tests\r\n    cabal test\r\n    hpc markup --destdir=hpc testsuite\r\n\r\nThis appears to generate HPC test coverage reports, but they are actually empty:\r\n\r\n    git checkout hpc-broken\r\n    cabal install --enable-tests --enable-coverage\r\n    cabal test\r\n\r\nIn this case, `cabal test` is supposed to generate the coverage reports for you, so the last `hpc` line from the other example should not be needed.  The only difference between the two branches is a `ghc-options: -fhpc` line in the cabal file.\r\n\r\nThe biggest problem here is that I actually can't use the hpc-works approach because `cabal sdist` says that I should not use the `-fhpc` option inside my .cabal file and that hackage will reject my package.\r\n\r\nOne other thing that would be good to keep in mind here is that `hpc` allows you to tweak things with a variety of command line flags like --exclude, --include, etc.  Whatever solution cabal gives us should still make it possible to specify your own flags.  Maybe this is as simple as putting the coverage data in a predictable place so you can run `hpc` manually.  But it is still probably something that we need to think about if we're going to continue outlawing `-fhpc` in .cabal files.\r\n\r\nThis is with cabal-install-1.25.0.0.  I think built from commit a92bfc8dfa806e998d49bc661a65020bfb335694"},"comment":{"url":"https://api.github.com/repos/haskell/cabal/issues/comments/238333174","html_url":"https://github.com/haskell/cabal/issues/3682#issuecomment-238333174","issue_url":"https://api.github.com/repos/haskell/cabal/issues/3682","id":238333174,"user":{"login":"ezyang","id":13564,"avatar_url":"https://avatars.githubusercontent.com/u/13564?v=3","gravatar_id":"","url":"https://api.github.com/users/ezyang","html_url":"https://github.com/ezyang","followers_url":"https://api.github.com/users/ezyang/followers","following_url":"https://api.github.com/users/ezyang/following{/other_user}","gists_url":"https://api.github.com/users/ezyang/gists{/gist_id}","starred_url":"https://api.github.com/users/ezyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezyang/subscriptions","organizations_url":"https://api.github.com/users/ezyang/orgs","repos_url":"https://api.github.com/users/ezyang/repos","events_url":"https://api.github.com/users/ezyang/events{/privacy}","received_events_url":"https://api.github.com/users/ezyang/received_events","type":"User","site_admin":false},"created_at":"2016-08-08T18:33:32Z","updated_at":"2016-08-08T18:33:32Z","body":"Oddly enough, `-fhpc` does seem to be passed to GHC for all invocations. So I am not sure why the workaround works:\r\n\r\n```\r\nezyang@sabre:~/Dev/labs/map-syntax$ /opt/cabal/1.24/bin/cabal test -v\r\nComponent build order: test suite 'testsuite'\r\ncreating dist/build\r\ncreating dist/build/autogen\r\n/usr/bin/ghc-pkg init dist/package.conf.inplace\r\nPreprocessing test suite 'testsuite' for map-syntax-0.2.0.1...\r\nBuilding test suite testsuite...\r\ncreating dist/build/testsuite\r\ncreating dist/build/testsuite/testsuite-tmp\r\n/usr/bin/ghc --make -no-link -fbuilding-cabal-package -O -fhpc -hpcdir dist/hpc/vanilla/mix/testsuite -j1 -static -outputdir dist/build/testsuite/testsuite-tmp -odir dist/build/testsuite/testsuite-tmp -hidir dist/build/testsuite/testsuite-tmp -stubdir dist/build/testsuite/testsuite-tmp -i -idist/build/testsuite/testsuite-tmp -isrc -itest -idist/build/autogen -Idist/build/autogen -Idist/build/testsuite/testsuite-tmp -optP-include -optPdist/build/autogen/cabal_macros.h -hide-all-packages -package-db dist/package.conf.inplace -package-id HUnit-1.3.0.0-904109a490c85ff643c14c4cfbe058fb -package-id QuickCheck-2.8.1-2cs6jeUUZX9ZLDN6ycKJHM -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d -package-id containers-0.5.6.2-59326c33e30ec8f6afd574cbac625bbb -package-id deepseq-1.4.1.1-614b63b36dd6e29d2b35afff57c25311 -package-id hspec-2.2.3-26H6GBDRpLQCyZpmHWBtcW -package-id mtl-2.2.1-378RFoja0lduCvzTAM9NPi -package-id transformers-0.4.2.0-81450cd8f86b36eaa8fa0cbaf6efc3a3 -XHaskell2010 test/TestSuite.hs -Wall -fwarn-tabs\r\n[1 of 4] Compiling Data.Map.Syntax  ( src/Data/Map/Syntax.hs, dist/build/testsuite/testsuite-tmp/Data/Map/Syntax.o )\r\n[2 of 4] Compiling Data.Map.Syntax.Util ( test/Data/Map/Syntax/Util.hs, dist/build/testsuite/testsuite-tmp/Data/Map/Syntax/Util.o )\r\n[3 of 4] Compiling Data.Map.Syntax.Tests ( test/Data/Map/Syntax/Tests.hs, dist/build/testsuite/testsuite-tmp/Data/Map/Syntax/Tests.o )\r\n\r\ntest/Data/Map/Syntax/Tests.hs:10:1: Warning:\r\n    The import of ‘Data.Monoid’ is redundant\r\n      except perhaps to import instances from ‘Data.Monoid’\r\n    To import instances alone, use: import Data.Monoid()\r\n[4 of 4] Compiling Main             ( test/TestSuite.hs, dist/build/testsuite/testsuite-tmp/Main.o )\r\nLinking...\r\n/usr/bin/ghc --make -fbuilding-cabal-package -O -fhpc -hpcdir dist/hpc/vanilla/mix/testsuite -static -outputdir dist/build/testsuite/testsuite-tmp -odir dist/build/testsuite/testsuite-tmp -hidir dist/build/testsuite/testsuite-tmp -stubdir dist/build/testsuite/testsuite-tmp -i -idist/build/testsuite/testsuite-tmp -isrc -itest -idist/build/autogen -Idist/build/autogen -Idist/build/testsuite/testsuite-tmp -optP-include -optPdist/build/autogen/cabal_macros.h -hide-all-packages -package-db dist/package.conf.inplace -package-id HUnit-1.3.0.0-904109a490c85ff643c14c4cfbe058fb -package-id QuickCheck-2.8.1-2cs6jeUUZX9ZLDN6ycKJHM -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d -package-id containers-0.5.6.2-59326c33e30ec8f6afd574cbac625bbb -package-id deepseq-1.4.1.1-614b63b36dd6e29d2b35afff57c25311 -package-id hspec-2.2.3-26H6GBDRpLQCyZpmHWBtcW -package-id mtl-2.2.1-378RFoja0lduCvzTAM9NPi -package-id transformers-0.4.2.0-81450cd8f86b36eaa8fa0cbaf6efc3a3 -XHaskell2010 test/TestSuite.hs -o dist/build/testsuite/testsuite -Wall -fwarn-tabs\r\nLinking dist/build/testsuite/testsuite ...\r\nRunning 1 test suites...\r\nTest suite testsuite: RUNNING...\r\ndist/build/testsuite/testsuite\r\nTest suite testsuite: PASS\r\nTest suite logged to: dist/test/map-syntax-0.2.0.1-testsuite.log\r\n/srv/prod/bin/hpc markup dist/hpc/vanilla/tix/testsuite/testsuite.tix '--destdir=dist/hpc/vanilla/html/testsuite' '--hpcdir=dist/hpc/vanilla/mix/testsuite' '--hpcdir=dist/hpc/vanilla/mix/map-syntax-0.2.0.1' '--exclude=Data.Map.Syntax' '--exclude=Data.Map.Syntax.Util' '--exclude=Data.Map.Syntax.Tests' '--exclude=Main'\r\nhpc: can not find 5Dy4335KtNp12MnuUhJwf2/Test.Hspec.Timer in ./.hpc, ./dist/hpc/vanilla/mix/map-syntax-0.2.0.1, ./dist/hpc/vanilla/mix/testsuite\r\nCallStack (from ImplicitParams):\r\n  error, called at libraries/hpc/Trace/Hpc/Mix.hs:119:15 in hpc-0.6.0.2:Trace.Hpc.Mix\r\n```"}}
{"actor":{"display_login":"ezyang"}}