-
Notifications
You must be signed in to change notification settings - Fork 11
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
Use io-classes
instead of unliftio
#50
base: master
Are you sure you want to change the base?
Conversation
If this is a drop-in replacement, then why is it a 1.6KLOC change? |
Stylish-haskell accidentally replaced all |
Much better now, without |
Thanks, but I still don't understand why this change is needed. Can you give an example of what this allows you to do that you couldn't do before? |
This allows us to run tests where the SUT runs in IOSim. We can now inject artificial file-system failures, exceptions, make time progress at different speed that real time, trace changes in TVars, or finding race conditions via IOSimPOR. In IOG we are using this to run some tests and we use IOSim extensively, we vendored temporarily a version of |
Think you can provide an example that makes use of any of what you just mentioned? I don't see how finding races with At the very least the changelog should be updated to mention these possibilities with links to docs. |
Let me write what I think would be useful for Sequential execution. First of all keep in mind this doesn't diminish the capabilities of running tests in normal IO. If tests are run in IOSim we can gather a trace of execution of any semantics step, observing changes to If tests are run in IOSimPOR, we can (on top of all the above) check for race conditions inside each specific semantics step. It is not unthinkable that a single command on the SUT forks multiple threads, which could deadlock. There is no way to currently check this, nor there is a way to inspect what an how this happens. One would have to find out in which step this happens, then introduce further inspection capabilities. With IOSimPOR, if a deadlock happens in any of the identified interleavings, then the program will halt immediately and we can observe a trace of the deadlock. For the parallel case, we wouldn't need to repeat the tests many times, as they would be deterministic (based on the generated commands). Also we would now be able to provide counterexample information/traces more accurately as parallel execution offers just one of the failing executions. And in general IOSimPOR will now be able to find races between different commands. I think these are extremely useful scenarios. I plan on writing a test-case that makes use of this machinery to exemplify what I mean. |
Good, looking forward to seeing it! |
I have been working a bit on this. The approach I followed is somewhat deeper than the one in this PR, and I now doubt that this PR is doing what we would want it to do. The fact that the whole test runs in I have implemented some functions in this PR input-output-hk/io-sim#179 in the Execute.hs module, which run a QSM-like execution via IOSim/IOSimPOR. See the tests added in the PR to get a sense of what can this framework do. There are still some outstanding issues, like messages not being delivered promptly input-output-hk/io-sim#180 but in general this looks quite useful. In short, I needed to add a new function It is still a WIP, but maybe you want to take a look. |
io-classes
is a drop-in replacement for IO that allows to run code inIOSim
which can simulate most aspects ofIO
(see).