cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Add support for the -fprof-late flag new in 9.4

Open AndreasPK opened this issue 3 years ago • 3 comments


Please include the following checklist in your PR:

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


I tested this locally. Still need to add a changelog entry.

AndreasPK avatar Oct 12 '22 19:10 AndreasPK

Thank you, that's a long awaited feature! Is this a genuine error in CI or does some hash in a test need updating after your change?

Mikolaj avatar Oct 12 '22 21:10 Mikolaj

Thank you, that's a long awaited feature! Is this a genuine error in CI or does some hash in a test need updating after your change?

Not sure. I don't know which parts of Cabal affect the hash. I did add some constructors and a new field so it seems possible.

AndreasPK avatar Oct 12 '22 22:10 AndreasPK

Thank you, that's a long awaited feature! Is this a genuine error in CI or does some hash in a test need updating after your change?

Not sure. I don't know which parts of Cabal affect the hash. I did add some constructors and a new field so it seems possible.

The hash also changes locally when running the tests. I will have to look into that as I don't just wanna update the cache without understanding why it changed. But I'm thankful if anyone has hints how that might have happened.

AndreasPK avatar Oct 12 '22 22:10 AndreasPK

I looked a little bit closer and I think the hash change is to be expected, since you modify the types that likely go into LocalBuildInfo. So I'd just update the hash and be glad it guards against reverting the change.

Mikolaj avatar Oct 17 '22 12:10 Mikolaj

I looked a little bit closer and I think the hash change is to be expected, since you modify the types that likely go into LocalBuildInfo. So I'd just update the hash and be glad it guards against reverting the change.

Alright thanks will do in the near future.

AndreasPK avatar Oct 17 '22 16:10 AndreasPK

Turned out to be not so near but I updated the hash and rebased. Let's see what CI says.

AndreasPK avatar Dec 12 '22 11:12 AndreasPK

This seems like an CI issue but I'm not entirely sure. Not sure if I have rights to restart CI jobs.

Here is the key error:

Project settings changed, reconfiguring...

creating D:\a\cabal\cabal\cabal-testsuite\PackageTests\SDist\T7124\dist-newstyle\cache

creating D:\a\cabal\cabal\cabal-testsuite\PackageTests\SDist\T7124\dist-newstyle

creating D:\a\cabal\cabal\cabal-testsuite\PackageTests\SDist\T7124\dist-newstyle\cache

D:\a\cabal\cabal\cabal-testsuite\PackageTests\SDist\T7124\dist-newstyle\cache\conE6FD.tmp: renameFile:renamePath:MoveFileEx "\\\\?\\D:\\a\\cabal\\cabal\\cabal-testsuite\\PackageTests\\SDist\\T7124\\dist-newstyle\\cache\\conE6FD.tmp" Just "\\\\?\\D:\\a\\cabal\\cabal\\cabal-testsuite\\PackageTests\\SDist\\T7124\\dist-newstyle\\cache\\config": permission denied (Access is denied.) 

AndreasPK avatar Dec 12 '22 14:12 AndreasPK

@Mikolaj Any insight?

AndreasPK avatar Dec 14 '22 14:12 AndreasPK

Yes, I think we are getting this random very breakage often on Windows CI. Restarted.

Mikolaj avatar Dec 14 '22 14:12 Mikolaj

@AndreasPK: what CI issue? ;P

Mikolaj avatar Dec 14 '22 17:12 Mikolaj

@Mikolaj Seems CI passes now. Let me know if I need to do anything else.

AndreasPK avatar Dec 20 '22 14:12 AndreasPK

So it's ready for review, I presume? Let me mark it so and let's hope 2 reviewers show up.

Mikolaj avatar Dec 20 '22 14:12 Mikolaj

@AndreasPK: do you have any idea for a small test to add to our test suite that would guard against somebody reverting your changes?

A tiny changelog file would be very welcome, see https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog

Mikolaj avatar Dec 20 '22 14:12 Mikolaj

@AndreasPK: it would be cool to fit this into cabal 3.10. The windows is closing, though...

Mikolaj avatar Jan 10 '23 18:01 Mikolaj

@AndreasPK: it would be cool to fit this into cabal 3.10. The windows is closing, though...

I will try to take a look tomorrow.

AndreasPK avatar Jan 10 '23 19:01 AndreasPK

Please take another look.

AndreasPK avatar Jan 12 '23 02:01 AndreasPK

Does the test protect from somebody making a change that either completely ignores the new option (compiles without profiling) or makes it work as the normal profiling option?

Mikolaj avatar Jan 12 '23 13:01 Mikolaj

The test currently only checks if the profiling detail setting is accepted. Not which effect it has.

Ideally we would check for the annotation mode by grepping for the corresponding -fprof-* flag in the ghc invocation. I did spend some time looking into that but couldn't figure out a good way to check for that. Given that I couldn't find any tests for any of the other profiling-detail settings either I settled for the tests as they are.

If you think it's insufficient I would appreciate pointers to any test that does this sort of thing. I found some that look at the runtime output of the built executable but that's not really helpful here.

AndreasPK avatar Jan 12 '23 14:01 AndreasPK

You are right profiling is woefully undertested. All the more reason to add a bit more fleshed out test. How about something like

https://github.com/haskell/cabal/blob/master/cabal-testsuite/PackageTests/ReplCSources/cabal.test.hs

Would any late show up in -v2 output of a cabal job?

Mikolaj avatar Jan 12 '23 15:01 Mikolaj

BTW, when you are ready to merge, please set a label (squash+merge_me, I guess?) to let mergify do this, as per our process.

Mikolaj avatar Jan 12 '23 15:01 Mikolaj

You are right profiling is woefully undertested. All the more reason to add a bit more fleshed out test. How about something like

https://github.com/haskell/cabal/blob/master/cabal-testsuite/PackageTests/ReplCSources/cabal.test.hs

Would any late show up in -v2 output of a cabal job?

That was helpful I've added a test checking for the presence of the flag for ghc-9.4

I briefly tried adding a test for pre-9.4 that get's skipped when ghc is too old but run into some odd errors and I think I exhausted my motivation to work on the tests for this now.

AndreasPK avatar Jan 16 '23 13:01 AndreasPK

I briefly tried adding a test for pre-9.4 that get's skipped when ghc is too old but run into some odd errors and I think I exhausted my motivation to work on the tests for this now.

Thank you. Let's hope it doesn't format C: with older GHCs. Please feel free to set merge_me or squash+merge_me label and in 2 days this should get auto-merged.

Mikolaj avatar Jan 16 '23 13:01 Mikolaj

⚠️ This pull request got rebased on behalf of a random user of the organization. This behavior will change on the 1st February 2023, Mergify will pick the author of the pull request instead.

To get the future behavior now, you can configure bot_account options (e.g.: bot_account: { author } or update_bot_account: { author }.

Or you can create a dedicated github account for squash and rebase operations, and use it in different bot_account options.

mergify[bot] avatar Jan 20 '23 07:01 mergify[bot]