-
Notifications
You must be signed in to change notification settings - Fork 698
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
Various cabal-testsuite
improvements
#10225
Conversation
78c3ab3
to
d99812b
Compare
d99812b
to
f364868
Compare
Hm what a surprising failure on macOS! Will investigate |
skipIfOSX :: String -> IO () | ||
skipIfOSX why = skipIfIO ("OSX " <> why) isOSX | ||
|
||
skipIfCI :: Int -> IO () | ||
skipIfCI ticket = skipIfIO ("CI, see #" <> show ticket) =<< isCI | ||
|
||
skipIfCIAndWindows :: Int -> IO () | ||
skipIfCIAndWindows ticket = skipIfIO ("Windows CI, see #" <> show ticket) . (isWindows &&) =<< isCI | ||
|
||
skipIfCIAndOSX :: Int -> IO () | ||
skipIfCIAndOSX ticket = skipIfIO ("OSX CI, see #" <> show ticket) . (isOSX &&) =<< isCI | ||
|
||
expectBrokenIfWindows :: Int -> TestM a -> TestM a | ||
expectBrokenIfWindows ticket = expectBrokenIf isWindows ticket | ||
|
||
expectBrokenIfWindowsCI :: Int -> TestM a -> TestM a | ||
expectBrokenIfWindowsCI ticket m = do | ||
ci <- liftIO isCI | ||
expectBrokenIf (isWindows && ci) ticket m | ||
|
||
expectBrokenIfWindowsCIAndGhc :: String -> Int -> TestM a -> TestM a | ||
expectBrokenIfWindowsCIAndGhc range ticket m = do | ||
ghcVer <- isGhcVersion range | ||
ci <- liftIO isCI | ||
expectBrokenIf (isWindows && ghcVer && ci) ticket m | ||
|
||
expectBrokenIfWindowsAndGhc :: String -> Int -> TestM a -> TestM a | ||
expectBrokenIfWindowsAndGhc range ticket m = do | ||
ghcVer <- isGhcVersion range | ||
expectBrokenIf (isWindows && ghcVer) ticket m | ||
|
||
expectBrokenIfOSXAndGhc :: String -> Int -> TestM a -> TestM a | ||
expectBrokenIfOSXAndGhc range ticket m = do | ||
ghcVer <- isGhcVersion range | ||
expectBrokenIf (isOSX && ghcVer) ticket m | ||
|
||
expectBrokenIfGhc :: String -> Int -> TestM a -> TestM a | ||
expectBrokenIfGhc range ticket m = do | ||
ghcVer <- isGhcVersion range | ||
expectBrokenIf ghcVer ticket m | ||
|
||
flakyIfCI :: Int -> TestM a -> TestM a | ||
flakyIfCI ticket m = do | ||
ci <- liftIO isCI | ||
flakyIf ci ticket m | ||
|
||
flakyIfWindows :: Int -> TestM a -> TestM a | ||
flakyIfWindows ticket m = flakyIf isWindows ticket m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I buy it as an improvement having separate functions for so many combinations. It'd be great to have a little DSL for expressing such things and this looks like a step away from that. But it is tempting to go this route because it does save on typing. Perhaps if Haskell had a built-in the monadic bang (in the sense of this plugin), the savings here wouldn't be as noticeable. So, overall, I don't feel strongly about it, just curious what others think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, as I was writing them I was thinking the same. But overall I think it is useful to make the skip and broken messages as uniform as possible, to be able to grep the output.
Otherwise one might use "shared libs", another person uses "dynamic libs", another one makes a typo "shred libs", etc.
I will consider whether to add something like a DSL. But maybe this would be mergeable? At the very least I could put a comment in the code saying "TODO: this should be reworked into a DSL or some such".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to risk loss of uniformity. See for example https://hackage.haskell.org/package/xmonad-contrib-0.18.0/docs/XMonad-Util-WindowProperties.html.
In this case I'd have 4 parameters: expected state or action (skip, expect fail, expect pass, flaky…), predicate (cf. above WindowProperties, replacing your multiple conditionals), ticket, message. But this might indeed be future work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah i didn't explain myself. I think a DSL would be uniform and the best solution. What is not uniform is
skipIf noShared "no shared libs"
And somewhere else
skipIf noShared "no dyn libs"
Which is what was there before I introduced these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make that aspect of the message come from the DSL, and the explanation should give details. (In which case perhaps it should be optional, or absorbed into the ticket.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I managed to make the CI green. From my side there are no other blockers for merging this.
What is your opinion on the combinators then @ulysses4ever @geekosaur ? Could this be merged and the DSL be done in a later PR or do you think this should not be merged before the DSL is done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By no means I meant that the DSL should be a prerequisite.
I simply struggle to get to the bottom of the long line of commits. For me personally, it'd be much easier to approve commits in separate PRs one by one. But I understand how inconvenient that approach is for the author. So I'll try to get a review done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some points I wanted to note down:
- It would have been perfectly ok if you said you wanted the DSL before approving, it is a perfectly valid opinion and I asked because I would have thought it was perfectly ok if you said "I will not give my approval until this PR has better ergonomics for the combinators like a DSL maybe"
- I have tried to split the changes semantically, one on each commit, so that it would be easier to review. Some of them are interesting, some are boring 😄
- (Btw, while reviewing you can choose to see only one commit at a time, that might make it easier)
- I'm fine with splitting the work in multiple PRs if it is independent (kind of like in this case, it could have been 4-5 PRs) but I think it is more work to drag attention to 5 PRs for review than to one. There is usually not enough volunteer-time to review this so I prefer just making it in one go 🙂 (as long as the commits are related, like in this case they are all about CI and tests)
- This being said, if you prefer I can split this PR in multiple PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I already suggested it should be future work? It wants some up-front design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For splitting: I think you should do it the way you prefer. For me personally reviewing and approving 5 small PRs can take much less time than reviewing 5 commits and approving one PR with those. That's simply because it's not possible to "save state" (meaning my mental state) in between the commits while there's a way to do that for multiple PRs (by approving them one by one). Unless I'm missing something in GitHub UI. I know that you can review commits separately (that's what I've been doing with this PR), but that's not the same as reviewing/approving/and forgetting about individual PRs (which works better for me). Again, you should do it the way you find it more convenient, I think.
For the DSL, I share Brandon's opinion (see the comment just above) entirely.
I think I fixed the MacOS issue with 4285454. Let's see what CI says, then I will address the review comments. For the DSL, I tried doing something last night but things started looking very bad as there were just too many edge cases and conditions applied in different places. I will give it some more thought. |
4285454
to
431bf9f
Compare
flaky
combinatorcabal-testsuite
improvements
431bf9f
to
82cb43c
Compare
The I will probably have to mark it as Skip on Windows+CI 🙄 or investigate with the tmate action. |
I deferred the investigation of those two tests to #10230. Before this PR they were skipped anyway on all OSes. |
54f1d18
to
b25a3ca
Compare
b25a3ca
to
6cd9030
Compare
May I ask for an approval if there are no further comments @ulysses4ever ? (Just pinging you because you had reviewed the pr already, I can ask in matrix if you can't review it) |
@jasagredo it's on my radar, yes. In the meantime, applying the needs-review label (just did it) and asking on Matrix may speed it up. I can't guarantee that I get to it today but I'll try my best. |
@mpickering I think you were one of the last people to do a meaningful update to the Cabal testsuite. Could you, perhaps, take a look at this PR? |
(e, out, err) <- readProcessWithExitCode real_path real_args "" | ||
putStrLn "# STDOUT:" | ||
putStrLn out | ||
putStrLn "# STDERR:" | ||
putStrLn err | ||
if "TestCodeFlaky" `isInfixOf` err | ||
then pure () | ||
else throwIO e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This grepping through stderr feels a little crude although I don't know a better way. Also, usually, when you switch from showing direct output to showing captured one, there are some side effects. E.g. colored output would be unavailable, etc. Of course, Cabal testsuite doesn't have colored output in particular but there may be spooky actions at the distance...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought maybe there was some other way to pipe this output of the process but I didn't seem to find one.
In any case this is only for when you invoke the tests with one test. I don't know how much that is used, I personally run the validate script always
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only for when you invoke the tests with one test
Oh, that's much less of a concern then. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it as unresolved for now maybe to see if anyone has other thoughts...
66beb26
to
d3f9c29
Compare
d3f9c29
to
2698f8c
Compare
Let's wait until the Windows CI is reenabled before merging this |
I set a dependency so Mergify should merge it automatically when #10282 goes in. |
2698f8c
to
d687371
Compare
These tests were testing for messages that were removed with the `cabal check` rework.
d687371
to
238c1f0
Compare
238c1f0
to
e14eacd
Compare
This was broken in haskell#10225
.bat
scripts for CCompilerOverride test look into the shipped toolchain for gcc/clang.flaky
combinator can be used to specify flaky tests with a ticket number. These will be reported as passing or failing but will not make the test-suite error.postCheckoutCommand
not flaky on Windows.Depends-On: #10282