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

Running cabal-install unit-tests fails due to Hpc failure #7384

Closed
fendor opened this issue May 7, 2021 · 7 comments
Closed

Running cabal-install unit-tests fails due to Hpc failure #7384

fendor opened this issue May 7, 2021 · 7 comments
Labels
cabal-install: tests/unit-tests can-workaround There is a (maybe partial) workaround for the issue or missing feature

Comments

@fendor
Copy link
Collaborator

fendor commented May 7, 2021

Describe the bug
Executing the test-suite via cabal run unit-tests in cabal-install sub-directory works fine on the first run.
After changing the test-suite, followed by executing the tests again the following error is thrown:

Hpc failure: module mismatch with .tix/.mix file hash number
(perhaps remove unit-tests.tix file?)

To Reproduce
Steps to reproduce the behavior:

$ cd cabal-install
$ cabal v2-run unit-tests -- -p "forkPackages"
$ # Modify test-suite slightly
$ cabal v2-run unit-tests -- -p "forkPackages" # Fails

Expected behavior
Should not crash

System information

  • Linux archlinux 5.11.16-arch1-1 #1 SMP PREEMPT Wed, 21 Apr 2021 17:22:13 +0000 x86_64 GNU/Linux
  • cabal 3.4.0.0 installed via ghcup
  • ghc 8.10.2 installed via ghcup
@emilypi
Copy link
Member

emilypi commented May 7, 2021

Pinging @hvr. Historically, when I brought this fact up, it was brushed off as "Not Cabal's Problem", because it is primarily due to the way HPC produces garbage and doesn't clean up after itself. I tend to agree, but I think until HPC gets its ducks in a row, Cabal should handle the cleanup and teardown when it creates coverage reports.

I would welcome PR's that help with this, and PR's that improve the general state of Coverage as Cabal handles it in general.

@fendor
Copy link
Collaborator Author

fendor commented May 7, 2021

Sounds like hpc needs some love.

@emilypi
Copy link
Member

emilypi commented May 7, 2021

It really does. It has no owner currently, and it's becoming bitrotten as a result. If you know anyone with free bandwidth to spare, hit up @bgamari or someone else on the GHC team and perhaps they can bring that person up to speed.

@ezyang
Copy link
Contributor

ezyang commented Jun 1, 2021

I feel it is even worse than reported here; in particular, I can induce this problem without any reference to profiling, e.g., cabal run cabal-testsuite:cabal-tests -- --with-cabal $(cabal list-bin cabal-install:cabal) cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs, rebuild cabal-install, and then run it again.

@Mikolaj
Copy link
Member

Mikolaj commented Jun 2, 2021

Now I understand why README.md say to use cabal install --project-file=cabal.project.release cabal-install. But requiring all cabal devs to specify the project file on each command is definitely too much.

@fendor fendor added the can-workaround There is a (maybe partial) workaround for the issue or missing feature label Jun 9, 2021
@fendor
Copy link
Collaborator Author

fendor commented Jun 9, 2021

Is fixed (or work-arounded) by #7421

@fendor fendor closed this as completed Jun 9, 2021
@BinderDavid
Copy link
Contributor

This is due to an (in my opinion) anti-feature of hpc: At program startup it tries to read in the .tix file and accumulates coverage information across multiple runs. This behaviour is documented in the hpc user guide:

The program may be run multiple times (e.g. with different test data), and the coverage data from the separate runs is accumulated in the .tix file. To reset the coverage data and start again, just remove the .tix file. You can control where the .tix file is generated using the environment variable HPCTIXFILE.

I just stumbled upon this problem myself. See https://gitlab.haskell.org/ghc/ghc/-/issues/23955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: tests/unit-tests can-workaround There is a (maybe partial) workaround for the issue or missing feature
Projects
None yet
Development

No branches or pull requests

6 participants