-
Notifications
You must be signed in to change notification settings - Fork 31
STM tests #61
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
STM tests #61
Conversation
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.
Happy to see some STM tests! 😃
I took a pass over this and it LGTM!
I commented on a few minor nits.
| Pop, Res ((Option Int, _), res) -> ( | ||
match List.rev s with [] -> res = None | j :: _ -> res = Some j) | ||
| Is_empty, Res ((Bool, _), res) -> ( | ||
match s with [] -> res | _ -> not res) |
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.
This could also be written: res = (s = [])
- which is a bit shorter
(is_closed, if not is_closed then i :: List.rev s |> List.rev else s) | ||
| Push_head i -> (is_closed, if not (is_closed && s = []) then i :: s else s) | ||
| Is_empty -> (is_closed, s) | ||
| Pop -> ( (is_closed, match s with [] -> s | _ :: s' -> s')) |
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.
double parens here
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.
This is actually done by ocamlformat
. Pretty weird. I raised an issue in ocamlfomat repo.
test/mpsc_queue/stm_mpsc_queue.ml
Outdated
| Is_empty, Res ((Result (Bool, Exn), _), res) -> | ||
if is_closed && s = [] then res = Error Mpsc_queue.Closed | ||
else if s = [] then res = Ok true | ||
else res = Ok false |
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.
these two lines can we written as else res = Ok (s = [])
I think
| Pop, Res ((Option Int, _), res) -> ( | ||
match s with [] -> res = None | j :: _ -> res = Some j) | ||
| Is_empty, Res ((Bool, _), res) -> ( | ||
match s with [] -> res | _ -> not res) |
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.
Or res = (s=[])
Thanks for the review ! Some |
Yes, I can see that one is consistently slow in the parallel version across the 4 GitHub CI runs. One suggestion could be to run a quick and dirty |
OK, I spent a bit of time digging into this. |
If the data structures are OK with having tests run in 3 different domains (creator/seq.prefix, producer, consumer) using the exported |
Come to think of it, we should add something like |
The PR ocaml-multicore/multicoretests#315 to add I've included
|
b7a78e9
to
639c4d2
Compare
Mmmh, I removed the @jmid : any idea when a new version of |
Indeed. The added bindings are not available in the previous release, hence the pin.
Perhaps next week. I'm currently trying to push out a new release of the underlying QCheck first, but opam-ci is on its knees. If my luck continues like this, you may have to wait longer. |
Add
Multicore.STM
tests for :spsc_queue
treiber_stack
michael_scott_queue
mpsc_queue