Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hack around wrong .mix directories for tests #7493

Merged
merged 7 commits into from
Jul 29, 2021
Merged

Conversation

Mikolaj
Copy link
Member

@Mikolaj Mikolaj commented Jul 24, 2021

This should fix #5213, except for multilib, which case is disabled anyway.

The correct way to fix this is to rethink directories for .mix HPC files (one directory per component is wrong) and pass around some generic package directory prefixes (not passed currectly) that enable looking up or creating the directories from each component. This should work even if components are HPC-processed in separate cabal runs (e.g., first library, only then tests). Perhaps then multilib can be enabled, unless HPC itself or GHC can't handle it.


Please include the following checklist in your PR:

Please also shortly describe how you tested your change. Bonus points for added tests!

@gbaz
Copy link
Collaborator

gbaz commented Jul 26, 2021

Its a fine hack for now, easier than the rather invasive looking Right Thing alternative.

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 26, 2021

I feel dirty anyway, but thank you. :)

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 26, 2021

@RyanGlScott, @davean, @cartazio, @fgaz, @ocharles: would one of you have a moment to review? thank you!

Copy link
Member

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray!

Cabal/src/Distribution/Simple/Hpc.hs Outdated Show resolved Hide resolved
@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 26, 2021

CI is acting up again.

@ocharles
Copy link
Contributor

I'm not sure I can give this a review, but I grabbed this PR and using it can successfully run cabal test ch-persistence --enable-coverage. Now whether that's due to this PR or mine, I can't say - but things certainly don't get worse with this PR!

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 27, 2021

I'm not sure I can give this a review, but I grabbed this PR and using it can successfully run cabal test ch-persistence --enable-coverage. Now whether that's due to this PR or mine, I can't say - but things certainly don't get worse with this PR!

Thank you. That's good news either way.

@ocharles
Copy link
Contributor

ocharles commented Jul 27, 2021

I may have spoken too soon. If I do cabal test ch-persistence --enable-coverage, it works. If I do cabal test ch-persistence with

package ch-persistence
  coverage: True

I get

/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/test/ch-persistence-1.0-tests.log
hpc: can not find ch-persistence-1.0-inplace/CircuitHub.Query.Progress in ./.hpc, /home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/hpc/vanilla/mix/ch-persistence-1.0, /home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/hpc/vanilla/mix/tests
CallStack (from HasCallStack):
  error, called at libraries/hpc/Trace/Hpc/Mix.hs:122:15 in hpc-0.6.1.0:Trace.Hpc.Mix
cabal: Tests failed for test:tests from ch-persistence-1.0

In this case, CircuitHub.Query.Progress is an exposed-module of ch-persistence.

I note that --enable-coverage builds everything with coverage, but the cabal.project.local variant only builds ch-persistence with coverage.

I'm not sure if this is something specific to this PR, or just another issue with coverage.

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 27, 2021

I think my hack should cover that and it looks as if the hack was not applied at all. How can I reproduce? Which repo is that?

@ocharles
Copy link
Contributor

Unfortunately this is private code that I can't share. I'll double check that I'm using your code from this PR.

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 27, 2021

In the failed run, the output of something like find . -name "*CircuitHub.Query.Progress.mix*" would be helpful, too. Perhaps the paths can be more complex than I assumed.

@ocharles
Copy link
Contributor

I've confirmed that the cabal I'm calling is patched:

sed -n '73{p;q}' (nix show-derivation (nix-store --query --deriver (which cabal)) | jq -r .'"/nix/store/phdr8slb3dgs5kb9jxjw0ngirsbhyhaz-cabal-install-exe-cabal-3.5.0.0.drv"'.env.src)/../Cabal/src/Distribution/Simple/Hpc.hs
  -- This is a hack for HPC over test suites, needed to match the directory

Here is the output of fd '.*' for ch-persistence with (good) and without (bad) --enable-coverage: https://gist.github.com/ocharles/5369f72d195ecd0a8a37f301d27bd3b8

@ocharles
Copy link
Contributor

What's very odd is that the .mix files seem to be in the same place, so maybe the hpc call itself is wrong.

Here is the "wrong" call (that crashes):

[pid 353787] execve("/nix/store/mlqhmb29fxlw89321s9imafnmphrcsr1-ghc-shell-for-packages-ghc-8.10.4-env/bin/hpc", ["/nix/store/mlqhmb29fxlw89321s9imafnmphrcsr1-ghc-shell-for-packages-ghc-8.10.4-env/bin/hpc", "markup", "/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/hpc/vanilla/tix/tests/tests.tix", "--destdir=/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/hpc/vanilla/html/tests", "--hpcdir=/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/hpc/vanilla/mix/tests", "--hpcdir=/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/t/tests/noopt/hpc/vanilla/mix/ch-persistence-1.0", "--include=CircuitHub.Pallet", "--include=CircuitHub.Pallet.FromPalletToInstalledSpace", "--include=CircuitHub.Pallet.TrayInstallation", "--include=CircuitHub.Pallet.UpdateCircuitHubTraysFromMycronic", "--include=CircuitHub.Persistence.Bin", "--include=CircuitHub.Persistence.Bin.Bin", "--include=CircuitHub.Persistence.Board", "--include=CircuitHub.Persistence.BoardOrder", "--include=CircuitHub.Persistence.BoardQuote", "--include=CircuitHub.Persistence.Bom", "--include=CircuitHub.Persistence.BomAggr", "--include=CircuitHub.Persistence.BomPart", "--include=CircuitHub.Persistence.BomSnapshot", "--include=CircuitHub.Persistence.BomSnapshotAggr", "--include=CircuitHub.Persistence.Category", "--include=CircuitHub.Persistence.Charge", "--include=CircuitHub.Persistence.Costs", "--include=CircuitHub.Persistence.CostTrack", "--include=CircuitHub.Persistence.CostType", "--include=CircuitHub.Persistence.Datasheet", "--include=CircuitHub.Persistence.Firmware", "--include=CircuitHub.Persistence.Footprint", "--include=CircuitHub.Persistence.Inst", "--include=CircuitHub.Persistence.Issue", "--include=CircuitHub.Persistence.Lot", "--include=CircuitHub.Persistence.Lot.Factoryless", "--include=CircuitHub.Persistence.Lot.Lot", "--include=CircuitHub.Persistence.Lot.NewLot", "--include=CircuitHub.Persistence.Lot.PurchaseOrder", "--include=CircuitHub.Persistence.Order", "--include=CircuitHub.Persistence.OrderAttachment", "--include=CircuitHub.Persistence.OrderBomSubstitutionApproval", "--include=CircuitHub.Persistence.OrderConsignmentAddressNotice", "--include=CircuitHub.Persistence.OrderConsignmentTrackingNumber", "--include=CircuitHub.Persistence.OrderPlacementDetails", "--include=CircuitHub.Persistence.OrderSubstitution", "--include=CircuitHub.Persistence.OrderSubstitutionAggr", "--include=CircuitHub.Persistence.OrderSubstitutionNotice", "--include=CircuitHub.Persistence.Organization", "--include=CircuitHub.Persistence.Outputs", "--include=CircuitHub.Persistence.Package", "--include=CircuitHub.Persistence.Pallet", "--include=CircuitHub.Persistence.Pallet.InstalledPallet", "--include=CircuitHub.Persistence.Pallet.InstalledTray", "--include=CircuitHub.Persistence.Pallet.NewInstalledPallet", "--include=CircuitHub.Persistence.Pallet.TrayEvent", "--include=CircuitHub.Persistence.Pallet.TrayLocation", "--include=CircuitHub.Persistence.Pallet.UpdateInstalledTray", "--include=CircuitHub.Persistence.Panel", "--include=CircuitHub.Persistence.Part", "--include=CircuitHub.Persistence.PartAggregate", "--include=CircuitHub.Persistence.PartRank", "--include=CircuitHub.Persistence.Periscope", "--include=CircuitHub.Persistence.Placement", "--include=CircuitHub.Persistence.PostgreSQL", "--include=CircuitHub.Persistence.PostgreSQL.Statement", "--include=CircuitHub.Persistence.PostgreSQL.TestDatabase", "--include=CircuitHub.Persistence.Progress", "--include=CircuitHub.Persistence.Project", "--include=CircuitHub.Persistence.PurchaseOrder", "--include=CircuitHub.Persistence.PurchaseOrderEx", "--include=CircuitHub.Persistence.PurchasingBomShortage", "--include=CircuitHub.Persistence.Quote", "--include=CircuitHub.Persistence.Rack", "--include=CircuitHub.Persistence.Rack.Location", "--include=CircuitHub.Persistence.Revision", "--include=CircuitHub.Persistence.Schematic", "--include=CircuitHub.Persistence.Source", "--include=CircuitHub.Persistence.Stock", "--include=CircuitHub.Persistence.Stripe", "--include=CircuitHub.Persistence.Substitute", "--include=CircuitHub.Persistence.Transaction", "--include=CircuitHub.Persistence.User", "--include=CircuitHub.Persistence.UserAddress", "--include=CircuitHub.Persistence.Workcell", "--include=CircuitHub.Persistence.Workcell.RackSlot", "--include=CircuitHub.Query.Bin", "--include=CircuitHub.Query.Board", "--include=CircuitHub.Query.BoardOrder", "--include=CircuitHub.Query.BoardSnapshot", "--include=CircuitHub.Query.BOM", "--include=CircuitHub.Query.BomPart", "--include=CircuitHub.Query.BomSnapshot", "--include=CircuitHub.Query.BomSnapshotLineage", "--include=CircuitHub.Query.Category", "--include=CircuitHub.Query.Charge", "--include=CircuitHub.Query.Component", "--include=CircuitHub.Query.Costs", "--include=CircuitHub.Query.CostSummary", "--include=CircuitHub.Query.CostType", "--include=CircuitHub.Query.Datasheet", "--include=CircuitHub.Query.Factory", "--include=CircuitHub.Query.Firmware", "--include=CircuitHub.Query.Footprint", "--include=CircuitHub.Query.Inst", "--include=CircuitHub.Query.Issue", "--include=CircuitHub.Query.Lot", "--include=CircuitHub.Query.Lot.Lots", "--include=CircuitHub.Query.MyData.Pallet", "--include=CircuitHub.Query.Order", "--include=CircuitHub.Query.OrderAttachment", "--include=CircuitHub.Query.OrderBomSubstitutionApproval", "--include=CircuitHub.Query.OrderConsignmentAddressNotice", "--include=CircuitHub.Query.OrderConsignmentTrackingNumber", "--include=CircuitHub.Query.OrderStats", "--include=CircuitHub.Query.OrderSubstitution", "--include=CircuitHub.Query.OrderSubstitutionAggr", "--include=CircuitHub.Query.OrderSubstitutionNotice", "--include=CircuitHub.Query.Organization", "--include=CircuitHub.Query.Package", "--include=CircuitHub.Query.Pallet", "--include=CircuitHub.Query.Pallet.InstalledPallets", "--include=CircuitHub.Query.Panel", "--include=CircuitHub.Query.Panelisation", "--include=CircuitHub.Query.Part", "--include=CircuitHub.Query.PartAggr", "--include=CircuitHub.Query.PartCost", "--include=CircuitHub.Query.PartFootprint", "--include=CircuitHub.Query.PartRank", "--include=CircuitHub.Query.PartSpec", "--include=CircuitHub.Query.PartSpecAggr", "--include=CircuitHub.Query.PartTestCentered", "--include=CircuitHub.Query.Periscope.BoardOrderStatus", "--include=CircuitHub.Query.Periscope.BoardsPerPanel", "--include=CircuitHub.Query.Periscope.ConsignedParts", "--include=CircuitHub.Query.Periscope.ConsignedPartsOverview", "--include=CircuitHub.Query.Periscope.Flow", "--include=CircuitHub.Query.Periscope.JetPrintStatus", "--include=CircuitHub.Query.Periscope.PackageProgramming", "--include=CircuitHub.Query.Periscope.PanelInfo", "--include=CircuitHub.Query.Periscope.PanelStateCount", "--include=CircuitHub.Query.Periscope.PartNotes", "--include=CircuitHub.Query.Periscope.PartsPipeline", "--include=CircuitHub.Query.Periscope.PartsPipelineInBin", "--include=CircuitHub.Query.Periscope.PartsPipelineOnPallet", "--include=CircuitHub.Query.Periscope.PartsPipelineOnTray", "--include=CircuitHub.Query.Periscope.PartsPipelinePurchaseOrder", "--include=CircuitHub.Query.Periscope.PartsPipelineSummary", "--include=CircuitHub.Query.Periscope.PlacementCount", "--include=CircuitHub.Query.Periscope.ShippedBoards", "--include=CircuitHub.Query.Periscope.SideDetails", "--include=CircuitHub.Query.Periscope.Substitutions", "--include=CircuitHub.Query.Placement", "--include=CircuitHub.Query.Privacy", "--include=CircuitHub.Query.Progress", "--include=CircuitHub.Query.Project", "--include=CircuitHub.Query.PurchaseOrder", "--include=CircuitHub.Query.PurchaseOrderEx", "--include=CircuitHub.Query.PurchaseOrderPartEx", "--include=CircuitHub.Query.PurchasingBomAggr", "--include=CircuitHub.Query.Quote", "--include=CircuitHub.Query.Rack", "--include=CircuitHub.Query.ReceivedToEntry", "--include=CircuitHub.Query.Revision", "--include=CircuitHub.Query.Schematic", "--include=CircuitHub.Query.Shipment", "--include=CircuitHub.Query.ShipmentEx", "--include=CircuitHub.Query.Source", "--include=CircuitHub.Query.Stripe", "--include=CircuitHub.Query.Substitute", "--include=CircuitHub.Query.SubstituteAggr", "--include=CircuitHub.Query.SubstituteFootprintComparison", "--include=CircuitHub.Query.SubstituteManufactureInfo", "--include=CircuitHub.Query.Task", "--include=CircuitHub.Query.Tray", "--include=CircuitHub.Query.User", "--include=CircuitHub.Query.UserAddress", "--include=Mycronic.DatabaseTag", "--include=Mycronic.Persistence", "--include=Mycronic.Persistence.Component", "--include=Mycronic.Persistence.Component.UpdateComponentPackage", "--include=Mycronic.Persistence.Events", "--include=Mycronic.Persistence.Layout", "--include=Mycronic.Persistence.Pallet", "--include=Mycronic.Persistence.Pallet.PalletInAtm", "--include=Mycronic.Persistence.Pallet.Traydata", "--include=Mycronic.Persistence.Pallet.UpdateTraydata", "--include=Mycronic.Query.Atm", "--include=Mycronic.Query.Boardposition", "--include=Mycronic.Query.Centering", "--include=Mycronic.Query.Component", "--include=Mycronic.Query.Gluedisp", "--include=Mycronic.Query.Leadgroup", "--include=Mycronic.Query.Machine", "--include=Mycronic.Query.Packheader", "--include=Mycronic.Query.Pallet", "--include=Mycronic.Query.Pallet.PalletsInAtms", "--include=Mycronic.Query.Referenceimage", "--include=Mycronic.Query.Referenceimageregion", "--include=Mycronic.Query.Schemas", "--include=Mycronic.Query.Segment", "--include=Mycronic.Query.Togglepoint", "--include=Mycronic.Query.Traydata", "--include=Mycronic.Query.Traypos", "--include=Mycronic.Query.Traytype", "--include=Rel8.Paginate"], 0x42000ea010 /* 187 vars */ <unfinished ...>

And here is the working call

[pid 379913] execve("/nix/store/vi6pnxbv5lsnvv0l96gcr04bjlmcjnxr-ghc-8.10.4/lib/ghc-8.10.4/bin/hpc", ["/nix/store/vi6pnxbv5lsnvv0l96gcr04bjlmcjnxr-ghc-8.10.4/lib/ghc-8.10.4/bin/hpc", "markup", "/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/noopt/hpc/vanilla/tix/ch-persistence-1.0/ch-persistence-1.0.tix", "--destdir=/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/noopt/hpc/vanilla/html/ch-persistence-1.0", "--hpcdir=/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/noopt/hpc/vanilla/mix/ch-persistence-1.0", "--hpcdir=/home/ollie/work/circuithub/dist-newstyle/build/x86_64-linux/ghc-8.10.4/ch-persistence-1.0/noopt/hpc/vanilla/mix/tests", "--include=CircuitHub.Pallet", "--include=CircuitHub.Pallet.FromPalletToInstalledSpace", "--include=CircuitHub.Pallet.TrayInstallation", "--include=CircuitHub.Pallet.UpdateCircuitHubTraysFromMycronic", "--include=CircuitHub.Persistence.Bin", "--include=CircuitHub.Persistence.Bin.Bin", "--include=CircuitHub.Persistence.Board", "--include=CircuitHub.Persistence.BoardOrder", "--include=CircuitHub.Persistence.BoardQuote", "--include=CircuitHub.Persistence.Bom", "--include=CircuitHub.Persistence.BomAggr", "--include=CircuitHub.Persistence.BomPart", "--include=CircuitHub.Persistence.BomSnapshot", "--include=CircuitHub.Persistence.BomSnapshotAggr", "--include=CircuitHub.Persistence.Category", "--include=CircuitHub.Persistence.Charge", "--include=CircuitHub.Persistence.Costs", "--include=CircuitHub.Persistence.CostTrack", "--include=CircuitHub.Persistence.CostType", "--include=CircuitHub.Persistence.Datasheet", "--include=CircuitHub.Persistence.Firmware", "--include=CircuitHub.Persistence.Footprint", "--include=CircuitHub.Persistence.Inst", "--include=CircuitHub.Persistence.Issue", "--include=CircuitHub.Persistence.Lot", "--include=CircuitHub.Persistence.Lot.Factoryless", "--include=CircuitHub.Persistence.Lot.Lot", "--include=CircuitHub.Persistence.Lot.NewLot", "--include=CircuitHub.Persistence.Lot.PurchaseOrder", "--include=CircuitHub.Persistence.Order", "--include=CircuitHub.Persistence.OrderAttachment", "--include=CircuitHub.Persistence.OrderBomSubstitutionApproval", "--include=CircuitHub.Persistence.OrderConsignmentAddressNotice", "--include=CircuitHub.Persistence.OrderConsignmentTrackingNumber", "--include=CircuitHub.Persistence.OrderPlacementDetails", "--include=CircuitHub.Persistence.OrderSubstitution", "--include=CircuitHub.Persistence.OrderSubstitutionAggr", "--include=CircuitHub.Persistence.OrderSubstitutionNotice", "--include=CircuitHub.Persistence.Organization", "--include=CircuitHub.Persistence.Outputs", "--include=CircuitHub.Persistence.Package", "--include=CircuitHub.Persistence.Pallet", "--include=CircuitHub.Persistence.Pallet.InstalledPallet", "--include=CircuitHub.Persistence.Pallet.InstalledTray", "--include=CircuitHub.Persistence.Pallet.NewInstalledPallet", "--include=CircuitHub.Persistence.Pallet.TrayEvent", "--include=CircuitHub.Persistence.Pallet.TrayLocation", "--include=CircuitHub.Persistence.Pallet.UpdateInstalledTray", "--include=CircuitHub.Persistence.Panel", "--include=CircuitHub.Persistence.Part", "--include=CircuitHub.Persistence.PartAggregate", "--include=CircuitHub.Persistence.PartRank", "--include=CircuitHub.Persistence.Periscope", "--include=CircuitHub.Persistence.Placement", "--include=CircuitHub.Persistence.PostgreSQL", "--include=CircuitHub.Persistence.PostgreSQL.Statement", "--include=CircuitHub.Persistence.PostgreSQL.TestDatabase", "--include=CircuitHub.Persistence.Progress", "--include=CircuitHub.Persistence.Project", "--include=CircuitHub.Persistence.PurchaseOrder", "--include=CircuitHub.Persistence.PurchaseOrderEx", "--include=CircuitHub.Persistence.PurchasingBomShortage", "--include=CircuitHub.Persistence.Quote", "--include=CircuitHub.Persistence.Rack", "--include=CircuitHub.Persistence.Rack.Location", "--include=CircuitHub.Persistence.Revision", "--include=CircuitHub.Persistence.Schematic", "--include=CircuitHub.Persistence.Source", "--include=CircuitHub.Persistence.Stock", "--include=CircuitHub.Persistence.Stripe", "--include=CircuitHub.Persistence.Substitute", "--include=CircuitHub.Persistence.Transaction", "--include=CircuitHub.Persistence.User", "--include=CircuitHub.Persistence.UserAddress", "--include=CircuitHub.Persistence.Workcell", "--include=CircuitHub.Persistence.Workcell.RackSlot", "--include=CircuitHub.Query.Bin", "--include=CircuitHub.Query.Board", "--include=CircuitHub.Query.BoardOrder", "--include=CircuitHub.Query.BoardSnapshot", "--include=CircuitHub.Query.BOM", "--include=CircuitHub.Query.BomPart", "--include=CircuitHub.Query.BomSnapshot", "--include=CircuitHub.Query.BomSnapshotLineage", "--include=CircuitHub.Query.Category", "--include=CircuitHub.Query.Charge", "--include=CircuitHub.Query.Component", "--include=CircuitHub.Query.Costs", "--include=CircuitHub.Query.CostSummary", "--include=CircuitHub.Query.CostType", "--include=CircuitHub.Query.Datasheet", "--include=CircuitHub.Query.Factory", "--include=CircuitHub.Query.Firmware", "--include=CircuitHub.Query.Footprint", "--include=CircuitHub.Query.Inst", "--include=CircuitHub.Query.Issue", "--include=CircuitHub.Query.Lot", "--include=CircuitHub.Query.Lot.Lots", "--include=CircuitHub.Query.MyData.Pallet", "--include=CircuitHub.Query.Order", "--include=CircuitHub.Query.OrderAttachment", "--include=CircuitHub.Query.OrderBomSubstitutionApproval", "--include=CircuitHub.Query.OrderConsignmentAddressNotice", "--include=CircuitHub.Query.OrderConsignmentTrackingNumber", "--include=CircuitHub.Query.OrderStats", "--include=CircuitHub.Query.OrderSubstitution", "--include=CircuitHub.Query.OrderSubstitutionAggr", "--include=CircuitHub.Query.OrderSubstitutionNotice", "--include=CircuitHub.Query.Organization", "--include=CircuitHub.Query.Package", "--include=CircuitHub.Query.Pallet", "--include=CircuitHub.Query.Pallet.InstalledPallets", "--include=CircuitHub.Query.Panel", "--include=CircuitHub.Query.Panelisation", "--include=CircuitHub.Query.Part", "--include=CircuitHub.Query.PartAggr", "--include=CircuitHub.Query.PartCost", "--include=CircuitHub.Query.PartFootprint", "--include=CircuitHub.Query.PartRank", "--include=CircuitHub.Query.PartSpec", "--include=CircuitHub.Query.PartSpecAggr", "--include=CircuitHub.Query.PartTestCentered", "--include=CircuitHub.Query.Periscope.BoardOrderStatus", "--include=CircuitHub.Query.Periscope.BoardsPerPanel", "--include=CircuitHub.Query.Periscope.ConsignedParts", "--include=CircuitHub.Query.Periscope.ConsignedPartsOverview", "--include=CircuitHub.Query.Periscope.Flow", "--include=CircuitHub.Query.Periscope.JetPrintStatus", "--include=CircuitHub.Query.Periscope.PackageProgramming", "--include=CircuitHub.Query.Periscope.PanelInfo", "--include=CircuitHub.Query.Periscope.PanelStateCount", "--include=CircuitHub.Query.Periscope.PartNotes", "--include=CircuitHub.Query.Periscope.PartsPipeline", "--include=CircuitHub.Query.Periscope.PartsPipelineInBin", "--include=CircuitHub.Query.Periscope.PartsPipelineOnPallet", "--include=CircuitHub.Query.Periscope.PartsPipelineOnTray", "--include=CircuitHub.Query.Periscope.PartsPipelinePurchaseOrder", "--include=CircuitHub.Query.Periscope.PartsPipelineSummary", "--include=CircuitHub.Query.Periscope.PlacementCount", "--include=CircuitHub.Query.Periscope.ShippedBoards", "--include=CircuitHub.Query.Periscope.SideDetails", "--include=CircuitHub.Query.Periscope.Substitutions", "--include=CircuitHub.Query.Placement", "--include=CircuitHub.Query.Privacy", "--include=CircuitHub.Query.Progress", "--include=CircuitHub.Query.Project", "--include=CircuitHub.Query.PurchaseOrder", "--include=CircuitHub.Query.PurchaseOrderEx", "--include=CircuitHub.Query.PurchaseOrderPartEx", "--include=CircuitHub.Query.PurchasingBomAggr", "--include=CircuitHub.Query.Quote", "--include=CircuitHub.Query.Rack", "--include=CircuitHub.Query.ReceivedToEntry", "--include=CircuitHub.Query.Revision", "--include=CircuitHub.Query.Schematic", "--include=CircuitHub.Query.Shipment", "--include=CircuitHub.Query.ShipmentEx", "--include=CircuitHub.Query.Source", "--include=CircuitHub.Query.Stripe", "--include=CircuitHub.Query.Substitute", "--include=CircuitHub.Query.SubstituteAggr", "--include=CircuitHub.Query.SubstituteFootprintComparison", "--include=CircuitHub.Query.SubstituteManufactureInfo", "--include=CircuitHub.Query.Task", "--include=CircuitHub.Query.Tray", "--include=CircuitHub.Query.User", "--include=CircuitHub.Query.UserAddress", "--include=Mycronic.DatabaseTag", "--include=Mycronic.Persistence", "--include=Mycronic.Persistence.Component", "--include=Mycronic.Persistence.Component.UpdateComponentPackage", "--include=Mycronic.Persistence.Events", "--include=Mycronic.Persistence.Layout", "--include=Mycronic.Persistence.Pallet", "--include=Mycronic.Persistence.Pallet.PalletInAtm", "--include=Mycronic.Persistence.Pallet.Traydata", "--include=Mycronic.Persistence.Pallet.UpdateTraydata", "--include=Mycronic.Query.Atm", "--include=Mycronic.Query.Boardposition", "--include=Mycronic.Query.Centering", "--include=Mycronic.Query.Component", "--include=Mycronic.Query.Gluedisp", "--include=Mycronic.Query.Leadgroup", "--include=Mycronic.Query.Machine", "--include=Mycronic.Query.Packheader", "--include=Mycronic.Query.Pallet", "--include=Mycronic.Query.Pallet.PalletsInAtms", "--include=Mycronic.Query.Referenceimage", "--include=Mycronic.Query.Referenceimageregion", "--include=Mycronic.Query.Schemas", "--include=Mycronic.Query.Segment", "--include=Mycronic.Query.Togglepoint", "--include=Mycronic.Query.Traydata", "--include=Mycronic.Query.Traypos", "--include=Mycronic.Query.Traytype", "--include=Rel8.Paginate"], 0x1bbd008 /* 187 vars */) = 0

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 27, 2021

Here is the output of fd '.*' for ch-persistence with (good) and without (bad) --enable-coverage

Thank you. The offending file is in exactly the same places in both cases, just as you note, and the places seems fine, so probably here the hack worked. The offending call to hpc indeed has arguments as if the hack wasn't applied.

I would try to reproduce, but the regression test contained in this very PR is as close as possible already (coverage via cabal.project, not commandline option) and it works fine.

Out of curiosity, why is the execve different between the two calls?

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 28, 2021

OK, I got a repro by adding

optimization: False

to cabal.project. Will investigate.

@ocharles
Copy link
Contributor

Wow, that is bizzare - but also something that's in my cabal.project! For the record, here's what I have:

-- See: https://cabal.readthedocs.io/en/latest/nix-local-build.html#developing-multiple-packages
-- This file is for local, dev builds only. Release builds done by Hydra are configured through Nix.

optimization:
  False

-- You can tune these settings according to your own machine by setting them in
-- cabal.project.local.
jobs:
  2

program-options
  ghc-options:
    -j2 -optl-fuse-ld=gold -fwrite-ide-info -fhide-source-paths
  ld-options:
    -fuse-ld=gold

package *
  ghc-options:
    -j2 -optl-fuse-ld=gold -fwrite-ide-info -fhide-source-paths
  ld-options:
    -fuse-ld=gold

packages:
  ./api/circuithub-api.cabal
  ./ch-authorize/*.cabal
  ./ch-aws/*.cabal
  ./ch-deploy/*.cabal
  ./ch-eda-all/ch-eda-core/*.cabal
  ./ch-eda-all/ch-eda-gerber/*.cabal
  ./ch-eda-all/ch-eda-integrater/*.cabal
  ./ch-eda-all/ch-eda-kicad/*.cabal
  ./ch-eda-all/ch-eda-gencad/*.cabal
  ./ch-eda-all/ch-eda/*.cabal
  ./ch-linear/*.cabal
  ./ch-model-hedgehog/*.cabal
  ./ch-model/*.cabal
  ./ch-persistence/*.cabal
  ./ch-segment/*.cabal
  ./ch-shippo/*.cabal
  ./ch-stripe/*.cabal
  ./ch-wai-extra/*.cabal
  ./daemons/**/*.cabal
  ./effects/**/*.cabal
  ./ex-pool-prometheus/*.cabal
  ./machine-learning/*.cabal
  ./mouse-proxy/*.cabal
  ./octopart/*.cabal
  ./pallet-loader/**/*.cabal
  ./picofactory/aoi/*.cabal
  ./picofactory/coordinator/*.cabal
  ./picofactory/jet-printer-programming/*.cabal
  ./picofactory/jpctl/*.cabal
  ./picofactory/my300/*.cabal
  ./picofactory/pallet-allocation/*.cabal
  ./picofactory/panelisation/*.cabal
  ./picofactory/pnp/*.cabal
  ./picofactory/ur10/ur10.cabal
  ./prelude/*.cabal
  ./quoting/*.cabal
  ./reconciliation/*.cabal

allow-newer:
  filepicker-policy:base

-- Needed for opencv
constraints: inline-c == 0.8.0.1, inline-c-cpp == 0.3.0.3

-- New versions don't seem to build
constraints: funflow == 1.5.0

-- servant-hmac-auth doesn't build with 0.18.2 due to internal API changes.
constraints: servant-client == 0.18, servant-client-core == 0.18

allow-newer: reactive-banana-gi-gtk:haskell-gi-base

constraints: streaming-bytestring == 0.1.6

-- 0.2.4.2 only works on GHC 9
constraints: th-utilities == 0.2.4.1

-- Use GTK 3
constraints: gi-gtk < 4

-- Without this cabal seems to pick 1.0.0.1, which doesn't build on GHC 8.10.
constraints: sexpresso == 1.1.0.0

allow-newer: active:base
allow-newer: comparable-key:hashable
allow-newer: diagrams-cairo:base
allow-newer: diagrams-core:base
allow-newer: diagrams-lib:base
allow-newer: diagrams-rasterific:base
allow-newer: diagrams-svg:base
allow-newer: dual-tree:base
allow-newer: mandrill:aeson
allow-newer: monoid-extras:base
allow-newer: monoidal-containers:aeson
allow-newer: network-bsd:network
allow-newer: reactive-banana:hashable
allow-newer: socket-activation:network
allow-newer: statestack:base
allow-newer: svg-builder:base

allow-newer: diagrams-contrib:*, force-layout:*

-- Without this, Cabal (or Haskell.nix) seems to get confused and occasionally tries 2.7.10 || 2.8. For now, we just pin it to 2.7.10
constraints: hspec-discover ==2.7.10

@cartazio
Copy link
Contributor

Future me thanks all of you for progressing this stuff!! Hpc / program coverage tooling is such a gem and everyone will benefit from this effort

@Mikolaj
Copy link
Member Author

Mikolaj commented Jul 28, 2021

@ocharles: could you try if it works for you now? The hack unfortunately got a bit more complex, because the paths turned out to be so (and they are even more complex when there are multiple components involved (more precisely, when distParamUnitId /= distParamComponentId, whatever that means), but I think HPC currently is disabled in these cases).

@mergify
Copy link
Contributor

mergify bot commented Aug 23, 2021

Command backport 3.6: success

Backports have been created

alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 22, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

However, the fix for haskell#5213, in haskell#7493, fixes the paths of the testsuite
`.mix` files to the same location as that of the main library component,
which in turn fixes haskell#4798 as well -- meaning the restriction to treat
testsuites per-package (legacy-fallback) is no longer needed.

Lifting this restriction additionally fixes haskell#6440 as we no longer
constrain coverage to per-package builds only, thus allowing multi-libs.

To generate hpc files in the appropriate component directories in the
distribution tree, we move the hack from haskell#7493 from dictating the `.mix`
directories where hpc information is stored to dictating the `.mix`
directories that are included in the call to `hpc markup`.

Fixes haskell#6440, and the already previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 22, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

However, the fix for haskell#5213, in haskell#7493, fixes the paths of the testsuite
`.mix` files to the same location as that of the main library component,
which in turn fixes haskell#4798 as well -- meaning the restriction to treat
testsuites per-package (legacy-fallback) is no longer needed.

Lifting this restriction additionally fixes haskell#6440 as we no longer
constrain coverage to per-package builds only, thus allowing multi-libs.

To generate hpc files in the appropriate component directories in the
distribution tree, we move the hack from haskell#7493 from dictating the `.mix`
directories where hpc information is stored to dictating the `.mix`
directories that are included in the call to `hpc markup`.

Fixes haskell#6440, and the already previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 22, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

However, the fix for haskell#5213, in haskell#7493, fixes the paths of the testsuite
`.mix` files to the same location as that of the main library component,
which in turn fixes haskell#4798 as well -- meaning the restriction to treat
testsuites per-package (legacy-fallback) is no longer needed.

Lifting this restriction additionally fixes haskell#6440 as we no longer
constrain coverage to per-package builds only, thus allowing multi-libs.

To generate hpc files in the appropriate component directories in the
distribution tree, we move the hack from haskell#7493 from dictating the `.mix`
directories where hpc information is stored to dictating the `.mix`
directories that are included in the call to `hpc markup`.

Includes regression tests for haskell#6440 and haskell#4798 (the test for haskell#5213
already exists)

Fixes haskell#6440, and the already previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 23, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

However, the fix for haskell#5213, in haskell#7493, fixes the paths of the testsuite
`.mix` files to the same location as that of the main library component,
which in turn fixes haskell#4798 as well -- meaning the restriction to treat
testsuites per-package (legacy-fallback) is no longer needed.

Lifting this restriction additionally fixes haskell#6440 as we no longer
constrain coverage to per-package builds only, thus allowing multi-libs.

To generate hpc files in the appropriate component directories in the
distribution tree, we move the hack from haskell#7493 from dictating the `.mix`
directories where hpc information is stored to dictating the `.mix`
directories that are included in the call to `hpc markup`.

Includes regression tests for haskell#6440 and haskell#4798 (the test for haskell#5213
already exists)

Fixes haskell#6440, and the already previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 28, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

However, the fix for haskell#5213, in haskell#7493, fixes the paths of the testsuite
`.mix` files to the same location as that of the main library component,
which in turn fixes haskell#4798 as well -- meaning the restriction to treat
testsuites per-package (legacy-fallback) is no longer needed.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we move the hack from haskell#7493 from dictating the `.mix`
directories where hpc information is stored to dictating the `.mix`
directories that are included in the call to `hpc markup`. We also drop
an unnecessary directory in the hpc file hierarchy.

3. To account for internal libraries, we include the mix dirs and
   exposed modules of all (non-indefinite) libraries in the package

4. We only add non-indefinite libraries to the hpc markup command.
    Indefinite libraries and instantiations are ignored as it is not
    obvious what it means for HPC to support backpack, e.g. covering a
    library function that two different instantiations

The combination of (1,3) fix haskell#6440, and adding (4) fixes haskell#6397

Includes regression tests for haskell#6440, haskell#6397, and haskell#4798 (the test for haskell#5213
already exists)

Fixes haskell#6440, haskell#6397, and fixes in a new way the previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 28, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

However, the fix for haskell#5213, in haskell#7493, fixes the paths of the testsuite
`.mix` files to the same location as that of the main library component,
which in turn fixes haskell#4798 as well -- meaning the restriction to treat
testsuites per-package (legacy-fallback) is no longer needed.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we move the hack from haskell#7493 from dictating the `.mix`
directories where hpc information is stored to dictating the `.mix`
directories that are included in the call to `hpc markup`. We also drop
an unnecessary directory in the hpc file hierarchy.

3. To account for internal libraries, we include the mix dirs and
   exposed modules of all (non-indefinite) libraries in the package

4. We only add non-indefinite libraries to the hpc markup command.
    Indefinite libraries and instantiations are ignored as it is not
    obvious what it means for HPC to support backpack, e.g. covering a
    library function that two different instantiations

The combination of (1,3) fix haskell#6440, and adding (4) fixes haskell#6397

Includes regression tests for haskell#6440, haskell#6397, and haskell#4798 (the test for haskell#5213
already exists)

Fixes haskell#6440, haskell#6397, and fixes in a new way the previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 30, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of libraries in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 30, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of libraries in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 30, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of libraries in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Nov 30, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of libraries in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

TODO: Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package...

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

TODO: Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package...

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

TODO: Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package...

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

TODO: Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package...

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

TODO: Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package...

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

TODO: Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package...

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 4, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 5, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 5, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 7, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
alt-romes added a commit to alt-romes/cabal that referenced this pull request Dec 12, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
andreabedini pushed a commit to alt-romes/cabal that referenced this pull request Dec 18, 2023
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
erikd pushed a commit to erikd/cabal that referenced this pull request Apr 22, 2024
This commits re-enables per-component builds when coverage checking is
enabled. This restriction was previously added in haskell#5004 to fix haskell#4798.

- haskell#4798 was subsequently fixed "again" with the fix for haskell#5213, in haskell#7493 by
fixing the paths of the testsuite `.mix` files to the same location as
that of the main library component.

Therefore the restriction to treat testsuites per-package
(legacy-fallback) is no longer needed.

We went further and fixed coverage for internal sublibraries, packages
with backpack (but without generating coverage information for
indefinite and instantiated units -- it is not clear what it would mean
for HPC to support this), and coverage for multi-package projects.

1. We allow hpc in per-component builds

2. To generate hpc files in the appropriate component directories in the
distribution tree, we remove the hack from haskell#7493 and instead determine
the `.mix` directories that are included in the call to `hpc markup` by
passing the list of components in the project from the cabal-install
invocation of test.
We also drop an unnecessary directory in the hpc file hierarchy.

3. To account for internal (non-backpack) libraries, we include the mix
   dirs and modules of all (non-indefinite and non-instantiations)
   libraries in the project

   Indefinite libraries and instantiations are ignored as it is not
   obvious what it means for HPC to support backpack, e.g. covering a
   library function that two different instantiations

4. We now only reject coverage if there are no libraries at all in the
   project, rather than if there are no libraries in the package.

This allows us to drop the coverage masking logic in
cabal.project.coverage while still having coverage of cabal-install
(i.e. cabal test --enable-coverage cabal-install now works without the
workaround)

Even though we allow multi-package project coverage, we still cover each
package independently -- the tix files resulting from all packages are
not combined for the time being.

Multi-package project coverage is fixed in Cabal, however, the
paths to the source files listed in the `.mix` files will be incorrect
because package sources will no longer be in the root of the project
tree, but rather under the subdir with the package. We add an error for
multi-package projects when coverage is enabled, and track lifting this
error in haskell#9493.

Includes tests for haskell#6440, haskell#6397, haskell#8609, and haskell#4798 (the test for haskell#5213 already exists)

Fixes haskell#6440 (internal libs coverage), haskell#6397 (backpack breaks coverage)
, doesn't yet fix haskell#8609 (multi-package coverage report) and fixes in a new way the
previously fixed haskell#4798, haskell#5213.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cabal new-test doesn't work with library-coverage for components with other-modules
6 participants