Ticket #592 (assigned defect)

Opened 4 years ago

Last modified 13 months ago

cabal test does not detect that cabal build needs to be re-run

Reported by: kowey Owned by: ttuegel
Priority: normal Milestone:
Component: Cabal library Version: 1.6.0.1
Severity: normal Keywords:
Cc: johan.tibell@… Difficulty: unknown
GHC Version: Platform:

Description (last modified by kowey) (diff)

This is a frequently recurring source of confusion in the Darcs team.

A: Such and such test fails

B: Have you re-run cabal build?

A: Oh, no I haven't

First seen on  http://bugs.darcs.net/issue1299

Attachments

cabal-test-bench-auto-build.dpatch Download (53.0 KB) - added by ttuegel 13 months ago.
Patch changing behavior of cabal tool to run 'cabal build' before 'cabal test' and 'cabal bench'.

Change History

  Changed 4 years ago by kowey

  • description modified (diff)

  Changed 4 years ago by guest

I think this may be a symptom of a slightly more general issue. As a user of cabal-install it is not always obvious which commands depend on other commands.

Also, I would imagine some users like the current behavior of cabal test, and perhaps ideally cabal could read my mind and magically behave in the way I prefer. So, if it turns out this is a controversial change, perhaps we could get an option in the cabal config to toggle this behavior?

Thanks!

  Changed 4 years ago by duncan

  • component changed from cabal-install tool to Cabal library

I'm inclined not to do anything here until the test hook is replaced by something useful, see #215. At that point it becomes clear what needs to be rebuilt because we actually have accurate information about it.

follow-up: ↓ 5   Changed 15 months ago by tibbe

  • cc johan.tibell@… added
  • owner set to ttuegel

We now have a test-suite section so this should be feasible to address. Thomas, what do you think?

in reply to: ↑ 4 ; follow-up: ↓ 6   Changed 15 months ago by ttuegel

Replying to tibbe:

We now have a test-suite section so this should be feasible to address. Thomas, what do you think?

We've discussed this before, and I think the conclusion we came to was that 'cabal test' should run 'cabal build' if necessary, but we should not change the behavior of './Setup test'. Is that still the consensus?

I'm not sure what was meant by "it becomes clear what needs to be rebuild because we actually have accurate information about it." Maybe this is naive, but I think if we simply call 'cabal build' before running 'cabal test', it will only rebuild what needs rebuilding. That is, I think all the checks we need are in place already. Am I missing something?

in reply to: ↑ 5   Changed 15 months ago by tibbe

Replying to ttuegel:

We've discussed this before, and I think the conclusion we came to was that 'cabal test' should run 'cabal build' if necessary, but we should not change the behavior of './Setup test'. Is that still the consensus?

Sounds good to me.

I'm not sure what was meant by "it becomes clear what needs to be rebuild because we actually have accurate information about it." Maybe this is naive, but I think if we simply call 'cabal build' before running 'cabal test', it will only rebuild what needs rebuilding. That is, I think all the checks we need are in place already. Am I missing something?

Nope. Just run cabal build before.

  Changed 15 months ago by tibbe

Could you make sure cabal bench also implies cabal build while you're at it?

Changed 13 months ago by ttuegel

Patch changing behavior of cabal tool to run 'cabal build' before 'cabal test' and 'cabal bench'.

follow-up: ↓ 9   Changed 13 months ago by ttuegel

Even with the patch I just attached, 'cabal configure' needs to be run first, but I doubt we want to change that behavior.

in reply to: ↑ 8 ; follow-ups: ↓ 10 ↓ 11   Changed 13 months ago by tibbe

Replying to ttuegel:

Even with the patch I just attached, 'cabal configure' needs to be run first, but I doubt we want to change that behavior.

I think we do! We already run configure automatically before build in most cases. I think we should always do that.

in reply to: ↑ 9   Changed 13 months ago by ttuegel

  • status changed from new to assigned

Replying to tibbe:

Replying to ttuegel:

Even with the patch I just attached, 'cabal configure' needs to be run first, but I doubt we want to change that behavior.

I think we do! We already run configure automatically before build in most cases. I think we should always do that.

That's a good point. I need to remake the patch for the new Git repo anyway; I'll make sure that's included.

in reply to: ↑ 9 ; follow-up: ↓ 12   Changed 13 months ago by ttuegel

Replying to tibbe:

Replying to ttuegel:

Even with the patch I just attached, 'cabal configure' needs to be run first, but I doubt we want to change that behavior.

I think we do! We already run configure automatically before build in most cases. I think we should always do that.

OK, it's easy enough to configure and build before 'cabal test' or 'cabal benchmark'. Obviously, these commands have been updated to take the 'cabal configure' options, as well. I thought about installing dependencies, too, but decided against it: I don't think people expect 'cabal test' to install packages on their system, so it's probably not a good idea. Just checking, but is this the behavior you would expect, i.e., configure and build, but don't install missing dependencies?

in reply to: ↑ 11   Changed 13 months ago by tibbe

Replying to ttuegel:

OK, it's easy enough to configure and build before 'cabal test' or 'cabal benchmark'. Obviously, these commands have been updated to take the 'cabal configure' options, as well. I thought about installing dependencies, too, but decided against it: I don't think people expect 'cabal test' to install packages on their system, so it's probably not a good idea. Just checking, but is this the behavior you would expect, i.e., configure and build, but don't install missing dependencies?

I think it's a good compromise for now. I'd prefer if (and have argued for) cabal build/test/bench to "do what I mean." Until we all agree that they should install dependencies etc I think having cabal test imply cabal configure and cabal build is a good compromise for now.

Note: See TracTickets for help on using tickets.