-
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
Feature Request: New component-test-depends section #7505
Comments
@Mikolaj can we prioritise this please? |
@newhoggy: aren't the times you are showing swapped? Is the runtime with Is the goal to have a cheaper variant of |
Wouldn't this be better solved by making |
@newhoggy: while we are at that, any easy way to reproduce the problem? Strangely I can't find any mention of |
Related issues asking for similar functionality:
There is a a pattern here, maybe an opportunity to make something more generic? |
This does looks like a run-tool-depends with no separate build plan. I wonder though if your original problem could be solved in a more straightforward way, namely moving the executable code in an internal library, using that in build-depends in the text stanza, and calling the main function in the test code with the appropriate arguments/environment/argv. Would this be ok and if not why? Are there multiple tools that call each other? |
Yes. That sounds right.
They're not really tools, but various executables that communicate with each other via the various kinds of IPC and form a larger system. Each executable component may have an interface includes things like command line arguments, environment variables, various kinds of IPC (filedescriptors/namedpipes/socket/signals) etc, some of which are OS specific. The idea is to integration test them using Haskell code. It is better that these components remain as separate executables because that's how they'll be used in the real world and killing a process provides a good way to cleanup OS resources in a manner that killing a thread does not provide. Being able to clean up OS resources reliably provides an important means of test isolation. We also have regression tests which invoke a shell script from Haskell tests which in turn invoke various executables with the goal of ensuring the shell scripts aren't broken by commits. |
|
@angerman: surely, let's prioritise the brainstorming and come up with a good design, while we fix related slowdowns in other tickets. @newhoggy: thank you for fixing and clarifying the initial requirements. @michaelpj: you are right, I missed that |
Please bear with this rather circuitous description of an insight/idea I had: In trying to think about this issue, I came at first to a conclusion similar to @michaelpj -- like, who's to say that solving for this is any faster than solving for build-tool-depends. Then I started thinking a bit more about what this would not do that the other does -- I suppose it would not introduce sub-components to solve for, but would instead just do the "plain" solving and only reorder the build-plan to ensure everything is built in an order respecting the constraints? But this raises the question -- why is sub-component solving slower than just plain solving? And the answer must be that the components get solved multiple times. But as per the discussion in the other ticket -- components are supposed to be linked so they get solved once and only once (if possible), right? So, my thought is that there might be something order dependent in if that linking actually saves time or not -- i.e. if B build-tool-depends on A, then solving A before B might attempt to reuse A, but solving B before A means solving B:A first, and that might not get reused for A? Perhaps there's something quadratic or worse if we have a huge chain of build-tool-depends so we get A:B:C:D solved and also B:C:D solved and etc..? And somehow the order of solving prevents the linking from ensuring solver-reuse? @newhoggy does that correspond to how your repo works? @grayjay what do you think about that being perhaps at issue? (Edit: Let me add the conclusion to this ramble. It seems that if we can isolate this quadratic issue then we can indeed solve it directly for build-tool-depends rather than adding a new clause to the cabal grammar.) |
I did a grep to find chains of
In the above, There could be hackage dependencies that do the same thing. |
Yep. If The reason I raised the ticket is because I had the same intuition that adding an extra dependency link should not add any additional solving work because the component was already in the build plan. My model of how it could work is that we could solve as if the Those components would be included anyway because they are already a build target. Then post solving, when it comes time to build, in order to determine the partial order for building, the dependency graph could be updated to include build-tool-depends, which would delay, for example, the running of There may be implementation details that make this impractical that I don't see because I don't actually know how cabal works. There are certainly some cabal behaviours I find surprising that suggests my model of how cabal works is not accurate. |
with the perf issues with build-tool-depends solving now resolved, can we close this ticket and just say "build-tool-depends should also be used for test component dependencies"? |
Thanks so much for resolving the solver performance issue! |
Link to the PR or commit that solved the performance issue? Also, please put some informative tags on this issue. |
@andreasabel: mostly #7532, but also other PRs linked in the original ticket. What tags do you have in mind? Would you like to suggest some? |
E.g. |
Here you go. :) |
Describe the feature
Currently we have the
build-tool-depends
feature. This is normally used to ensure build tools are built so that the build tool can be used during the build process.We have been abusing this feature for another purpose which is to ensure that executables are built before tests are run. This is useful for CLI tests or integration tests where you would want the CLI executable to integration component to be already built before running the test.
This is especially useful to ensure that we aren't accidentally picking up stale executables that haven't been built which is a problem we've experienced in the development process and caused much confusion.
Unfortunately,
build-tool-depends
does a lot more than just ensuring the executable is built, which incurs additional costs. Specifically, it seems to significantly at to constraint resolution times. For example:With
build-tool-depends
:Without
build-tool-depends
:On Windows, for some reason we are forced to use
reorder-goals
or the constraint resolution fails, but this can bring the constraint resolution time to about 20 minutes.If we could avoid using
build-tool-depends
, we hope to cut constraint resolution times by 66%, which is a substantial gain.The text was updated successfully, but these errors were encountered: