Skip to content
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

Any interest in a way to check that a state is possible? #284

Open
hgoldstein95 opened this issue Jul 5, 2022 · 0 comments
Open

Any interest in a way to check that a state is possible? #284

hgoldstein95 opened this issue Jul 5, 2022 · 0 comments

Comments

@hgoldstein95
Copy link

hgoldstein95 commented Jul 5, 2022

It occurred to me that certain tests might want to say "there exists a thread interleaving where assertion". For example, one of the loom tests in Jon Gjengset's haphazard crate checks that a sum of a bunch of counts is equal to 1, but additionally it should be the case that each of these counts is individually equal to 1 in some execution. Additional checks like this would help to rule out fairly insidious bugs where one of the operations is accidentally a no-op.

I expect this could be implemented on a case-by-case basis by stepping around loom. One could set up an AtomicBool flag outside of the model, set the flag to true if the desired state is reached, and then check that the flag is true at the end. But that seems a bit clunky and potentially error prone (e.g., loom might want to disable this feature for tests that prune interleavings).

Would y'all be interested in seeing a PR that adds a feature like this to loom? I'm not asking for help or resources, really, I just don't want to implement this if there are serious objections at the outset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant