-
Notifications
You must be signed in to change notification settings - Fork 696
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
Allow "cycles" through test suite dependencies #3232
Conversation
I guess we should also give benchmarks the same treatment. Would be nice to also have an integration test for this feature. |
This needs docs. |
What kind of docs? |
"we add qualifiers to the dependencies of a test suite section, but only those that are not shared with the main library (or are internal)" --> From the user's perspective, what does this mean? What behavior should I expect Cabal to have? Under what circumstances will this not "do the right thing"? |
Yes, would be nice if the manual section on test suites said something about cycles. The relevant file is |
I've merged these patches to the nix-local-build branch (along with all the other recent solver PRs). |
@ezyang @23Skidoo pushed a commit that adds a subsection to the section on test suites, explaining both the rationale and what exactly is and isn't supported. Let me know if it's insufficient. @dcoutts Not sure if you want to cherry-pick this extra commit as well, just in case we might merge this PR through the |
@edsko Can you look into the build bot failure? |
@23Skidoo |
@23Skidoo I briefly looked at the integration tests in |
@edsko I'm pretty sure I fixed this problem when I merged nix-local-build-1.25.x but it might be a little difficult to figure out what the extra patch is. |
Try this:
|
To be clear: this PR adjusts the solver so that it can select different versions of the library in an executable, but it doesn't adjust Cabal the library so that it will accept this (or maybe it will accept it?) EDIT: I now understand that this will work with the Cabal library unchanged, although for a non-obvious reason which I recorded in #3286. |
@23Skidoo / @ezyang I've just added an integration test that tests whether this actually works (and it does), although I do have to admit the subtleties @ezyang reports in #3286 did not occur to me. @23Skidoo I'm a little confused why this PR would result in compile errors; perhaps Anyway, I think this is already integrated somewhere? If so, would just need to cherry-pick the two additional commits for the user manual and the integration test. @23Skidoo Like I said before, not 100% sure what the correct approach to writing these integration tests is. Let me know if what I did is not correct. |
@edsko It's because it merged cleanly. When GitHub runs Travis, it first merges, and then runs it. But the clean merge is a lie! You need to apply my patch. Re the integration tests, some minor style guidelines:
Otherwise it looks fine. There are some infelicities with how to set up tests (e.g., finding executables) which someone should eventually fix, but this should be fine for now. |
Of course, this test currently fails.
When a test suite has a dependency which is not shared with the main library, we can consider it independent. This addresses #1575 to some degree. Suppose * optparse-applicative has a test suite that depends on tasty * tasty has a (regular) dependency on optparse-applicative We can resolve this by linking optparse-applicative's test suite against an older version of itself. This only works provided that optparse-applicative's test suite does not declare optparse-applicative as a dependency (and instead just compiles in the modules from the src/ directory or whatever). If the test suite did declare the library as a dependency, then clearly the test suite needs to be built against _this_ version of the library; it would be terribly confusing if the test suite got built against an older version. But if the test suite gets built against the library itself, then if the test suite also needs tasty, we cannot pick two different versions in the same application (yet). In this commit we add the appropriate qualifiers; however, the resulting install plan will now be rejected by the internal validity check. That's next up.
For test suites etc. we might want to allow for inconsistent dependencies. For instance, in the optparse-applicative -> tasty -> optparse-applicative dependency cycle we might want to allow two versions of optparse-applicative in the same executable (one that is the library-under-test and one used internally by tasty).
Details of the test in the README.
@ezyang I've tried rebasing the test but after doing that it's now failing with
does that ring any bells? |
Well, the message means that somehow the fake ID wasn't fixed up after A was installed. I... don't think I pushed any commits which should have broken this? But if that's what you say, it must be true... |
(Travis failed because you need to run |
@edsko I'll take a look at your other failure and see if I can fix it. |
There appears to be an unrelated problem, which is that the sandbox code is checking for consistent dependencies which isn't going to work. The way to reproduce is to try to install in the sandbox twice:
|
OK the bug is my problem; it's fixed in some in flight commits but I'll just fix it since those commits are under review. |
Test confirmed to work with #3283. I'll merge this and then rebase your set. |
@edsko Which ones of your solver PRs do you want included in 1.24? I'm a bit hesitant merging them so close to release given that there has been no review from @kosmikus and there are still some bugs according to @ezyang's comment in #3290. Can they wait for the 1.24.1 |
Not this one, but the rest seem to be working reasonably well. I would like to see #3268 go in because it definitely fixes a bug. |
Current status: #3290 (comment). |
Closing in favour of #3402. |
NOTE: This PR consists of three commits, not five. The first two commits below are #3220 .
Cycles through test suites are not uncommon. For example:
optparse-applicative
might want to have a test suite that usestasty
, buttasty
has a dependency onoptparse-applicative
.containers
might want to have a test suite that usestasty
, buttasty
has a dependency oncontainers
Issue #1575 suggests to do resolution on a component-by-component basis, and that would still be nice to have; but it would require more significant changes to the rest of cabal (in particular, to the execution of install plans). This PR is less ambitious: in the examples above, we would allow the dependency of
tasty
onoptparse-applicative
/containers
to be resolved by using a different (probably, though not necessarily, older, and possibly, though not necessarily, already installed) version. That is, the resulting executable would be linked against two versions of the libraries: the test suite itself is of course testing this version ofoptparse-applicative
/containers
, but the dependency oftasty
is satisfied by a different version of those libraries.One might even argue that this is the right solution to this particular problem (rather than doing per-component resolution): do we really want to test a new version of
containers
(possibly containing bugs) by using a test framework linked against that very same, possibly broken, version ofcontainers
?This PR consists of three orthogonal commits:
Pinging @dcoutts , @kosmikus ; @tibbe and @pcapriotti might also be interested.