-
Notifications
You must be signed in to change notification settings - Fork 701
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
Write debug output to stderr #7838
base: master
Are you sure you want to change the base?
Conversation
I struggle a bit to parse the output of the test failure. If anyone could nudge me in the right direction. That would be appreciated. |
From what I see, it expected to find the following on stderr, but didn't see it:
and you can find in the log earlier that this appears in stdout now, nondeterministically interleaved with some other output to stdout. Or it may all be the other way around. |
I'm realising now that the problem is not as simple as I first thought. For a starter If we want to retain that we'd need some sort of clever piping in |
Had a stab at it just now. See my attempts in
The value of
|
Concurrency is hard. If that helps, feel free to open a new PR exclusively about a given kind of minimal cabal-testsuite improvement. That would also make reviewing and testing easier. |
Yes. I think this is the way to go. I'll concern myself with splitting it up later though. For now I'm just hacking around. So to be clear there are currently two tasks:
|
Yes, I guess, that would make it possible to cheaply migrate most test and tweak only a couple to test the actual split. However, the mode would need to guarantee the combined output is deterministic. That's probably hard to do without flushing all the time. |
I see there was previous effort to work on this #4789. I wonder if that PR is still receiving life support. Judging by the creation date I would guess it's covered in cob webs. It also looks like there was a bit of a discussion around the desired functionality. @hvr mentioned that there might be cases where you would actually want Cabal to write to stdout. I think it could be good to consolidate some of the different discussions that are happening at #7838 (here), #4789, #7790, #5595, #4652. An authoritative and slightly more in-depth answer to the question "what output should go where?" would be needed to tackle #7790 but shouldn't stand in the way of expanding the capabilities of |
Agreed, somebody would need to summarize and maintainers would need to decide. However, there's lots of stalled PRs and undecided discussions and that should not stop progress that only comes through merged PRs and user feedback. All the other people involved previously are invited to experiment with the new implementation, tweak and amend afterwards. Edit: what we can easily do is add all the people from these tickets as reviewers at some point. |
3b1d3c5
to
1b28ab3
Compare
I think I managed to actually fix this issue with connecting a bunch of pipes together and waiting in the correct order. Laziness and asynchronicity is a potent coctail. Not for the faint of heart! |
Tests can now specify files with a `.stdout` or `.stderr` suffix to assert where Cabal writes output to. `.out` will continue to work for testing what output Cabal generates ignoring which file descriptor that output is sent to. This commit also simplifies the `test{,Normalized}{Actual,Expect}File{Out,Stdout,Stderr}` family of functions
It should be fairly easy to migrate the tests over. Simply:
|
So is the plan of action to ask for a preliminary review approval and, if obtrained, complete the legwork for the tests? How many relevant tests are passing already? How many are not? |
No I'll make all the tests green before requesting a review. I think that's the only proper way to go. I should've probably marked this as a draft until then. It's just a question of getting around to actually doing it :) |
Hi! How is it going? |
Hi Mikolaj. I've reached the conclusion that I cannot implement it the way I had envisaged where both stdout, stderr and their collective output are caught and the order of messages are preserved. I don't think it can be done. We should consider how we would want to implement this then. My proposal would be the following:
The implication of this is that you cannot test both which output goes where, and the order in which the collective output is generated. |
I don't think we mind the global order often, if at all. Does it mean we could get the same output as today (or at least deterministic enough) in tests, so that we can handle the golden tests method that we use in the biggest test suite(s)? |
With my sketched design it should be backwards compatible. But you cannot test both modes. So if you want to switch to testing |
Fair enough, that's an absolute improvement as is, worth merging IMHO. What about UI? How does the test writer request either normal mode or the seperate stdout and seperate stderr mode? |
So I would imagine that it ought to just switch into the new mode if you there is either a |
Hey @fredefox! I'm curious do you think you could finish it any time soon? Great work, and I hope it gets merged! |
@mergify rebase |
❌ Base branch update has failedGit reported the following error:
err-code: E7EF2 |
This fixes #7790
Please include the following checklist in your PR:
I tested this by running
cabal run
against another projects, verifying that all cabal-related output went into stderr, and output from my application went to stdout.