-
Notifications
You must be signed in to change notification settings - Fork 16
Add agree_prop_par_asym to STM_domain #315
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
Conversation
|
CC @lyrm as this could be helpful in ocaml-multicore/saturn#61 |
|
Great ! Thanks ! |
a9d9745 to
230310a
Compare
|
PR rebased on top of the merged #318. +let agree_test_par_asym ~count ~name =
+ let rep_count = 20 in
+ let seq_len,par_len = 20,12 in
+ Test.make ~retries:10 ~count ~name
+ (* "Owner domain" cmds can't be [Steal], "stealer domain" cmds can only be [Steal]. *)
+ (WSDT_dom.arb_triple_asym seq_len par_len WSDConf.arb_cmd WSDConf.arb_cmd WSDConf.stealer_cmd)
+ (fun ((seq_pref,cmds1,cmds2) as triple) ->
+ assume (WSDT_dom.all_interleavings_ok seq_pref cmds1 cmds2 WSDConf.init_state);
+ repeat rep_count WSDT_dom.agree_prop_par_asym triple)(We could also go further and export a version of |
shym
left a comment
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.
Maybe we could expose {neg_,}agree_test_par_asym functions, similar to the symmetric ones. I understand the idea that those tests are probably more useful with different command generators for each part but it would:
- make it easier to switch from symmetric to asymmetric testing (I would be curious to try it out on the whole test suite),
- give a reference implementation for the cases when you do need to tune it,
- it could maybe take as optional arguments the various arb_cmd if that’s the most probable tuning.
| let agree_prop_par_asym (seq_pref, cmds1, cmds2) = | ||
| let sut = Spec.init_sut () in | ||
| let pref_obs = interp_sut_res sut seq_pref in | ||
| let sema = Semaphore.Binary.make false in |
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.
Is there a reason to use a Semaphore rather than an Atomic like in the symmetric version?
| Semaphore.Binary.release sema; | ||
| try Ok (interp_sut_res sut cmds2) with exn -> Error exn) | ||
| in | ||
| while not (Semaphore.Binary.try_acquire sema) do |
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.
Using Semaphore, we could say Semaphore.Binary.acquire sema rather than using a loop. I don’t know if that would entail an undesirable delay, though.
|
I've
As to the choice of |
|
CI summary:
None of these are related to the current PR |
shym
left a comment
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 just reviewed the 4 extra commits: well done!
I think this is ready for merging.
|
|
||
| val neg_agree_test_par_asym : count:int -> name:string -> QCheck.Test.t | ||
| (** A negative asymmetric parallel agreement test (for convenience). | ||
| Accepts two labeled parameters: |
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 just notice this line because it appears in the diff: the 4 agree_test_par accept those labelled parameters but it is documented on two of them. The labels are self-explanatory, though.
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.
Fair enough! Addressed in b6a471a
|
CI summary:
|
This PR fixes #310 by adding an asymmetric property
agree_prop_par_asymtoSTM_domain.This is handy to run tests that spawn only 1 child domain to run and interpret
cmds in parallel with the parent domain.To make printing of such triples nicer, the PR includes a new triple generator
STM_domain.arb_triple_asymthat has a corresponding "symmetric printer" set.I pinned the patched version locally to see how this would help clean up the existing
ws_dequetest fromlockfree.For comparison, here's a diff:
I realize that
Changesentry