-
Notifications
You must be signed in to change notification settings - Fork 697
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 #3402
Conversation
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.
Signed-off-by: Edward Z. Yang <[email protected]>
Signed-off-by: Edward Z. Yang <[email protected]>
Current status:
|
Hmm, apparently we have a pre-receive hook that doesn't allow force-pushing to all branches (not just protected ones). |
I just tried this against if I interpret the
/cc @ezyang EDIT: where the first symbol comes from |
I'm not completely sure why this is perceived to be blocked by me. There seem to be more non-solver changes than solver changes here, and there was some discussion that the patch is still buggy, which at least according to @edsko is unlikely to be due to the solver part. For me to contribute further on this, I'd need someone who knows the history of this patch and understands the changes that are made to the non-solver part to explain to me what the issue is and what we are supposed to achieve here. |
@kosmikus Can you take a look at the solver parts of this PR at least? IIUC, the solver side is considered complete. |
The rationale for this change is given in #3232. There's also some documentation included in the PR itself. @edsko is the one to talk to about the implementation details. |
[ci skip]
Ok, perhaps I was confused then. I thought others had worked on this as well, and that it had something to do with sandboxes. |
Now I see that in #3232 it's mentioned that linking against multiple library versions is by design |
-- NOTE 2: This should be called on _all_ dependencies of a package. If it gets | ||
-- called on a subset of the dependencies, we might construct invalid | ||
-- quantifiers. In particular, we might conclude that a dependency of a test | ||
-- suite is not shared with the library and hence is independent. |
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 this is inconsistent with #3357. It added requalifyDeps
, which can call qualifyDeps
on only a subset of dependencies:
rdeps <- requalify deps |
Should this feature be controlled by a flag, since most test suites don't have cyclic dependencies, and inconsistent dependencies can lead to compile errors? |
@grayjay's comment that
is (as per usual.. 😓 ) an excellent observation and something that needs fixing before this can be merged. Sadly the fix won't be entirely trivial. |
@grayjay the hope is that this can actually be fully automatic. What kind of cases can lead to compile errors? Here's an example: suppose Or another example might be a testsuite or benchmark for bytestring or binary. If these testsuites/benchmarks in their support code need to call functions from their testing/benchmarking libs (QC, criterion, tasty etc) that themselves use e.g. the But again I don't think this is a common problem or a reasonable expectation that the support libs for your testsuite or benchmark code are themselves compiled against the code under test. Indeed I think the reverse expectation is much more reasonable. If I'm testing bytestring or binary or something, then I would much prefer it if criterion/quickcheck/tasty etc were built against existing stable versions of bytestring, binary etc than to try and build them against the code I'm currently testing. Also, this avoids having to rebuild all those support libs every time I make a minor change to the code under test. Another argument is that while yes in some cases there would be limitations on what you can do in the testsuite/benchmark since it's hard to make use of two versions of the same package (though we may be able to do something about this with package-qualified imports or the new backpack-style module renaming), these are not cases that work at all right now. So we're allowing more. If you or anyone can spot cases where it's not as rosy as this, please do say so. |
This branch needed rebasing, so I deleted and recreated it (couldn't force-push due to the pre-receive hook complaining). But apparently I can't reopen this PR now, so will open another. |
Asked support to re-enable force-pushes. |
Force-pushes now work again on feature branches. |
@23Skidoo for the record; the global force-push-protection predates the "protected branches" feature; in the past you had to ask the github admins to enable it repo-wide. Luckily now there's more granular protected branches user's can control via the web-UI (even though I'm still not satisfied by those, but it's better than nothing :-) ) |
Yeah, I figured as much. |
A version of #3232/#3290 updated to work with
master
. Also moved the branch to the upstream repo so that others can push to it./cc @ezyang @edsko