-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade QCheck STM to version with
wrap_cmd_seq
support
Also reorganize code under `test/` such that libraries are under `test/lib/`. Co-authored-by: Jan Midtgaard <[email protected]>
- Loading branch information
Showing
21 changed files
with
94 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pin-depends: [ | ||
[ "qcheck-stm.dev" "git+https://github.com/ocaml-multicore/multicoretests#59296ec5491475b191cac6babf8f290c9ced47a4" ] | ||
[ "qcheck-multicoretests-util.dev" "git+https://github.com/ocaml-multicore/multicoretests#59296ec5491475b191cac6babf8f290c9ced47a4" ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
test/stm_run/stm_run.ocaml4.ml → test/lib/stm_run/stm_run.ocaml4.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(library | ||
(package picos_meta) | ||
(name stm_wrap) | ||
(modules stm_wrap) | ||
(libraries | ||
picos | ||
(select | ||
stm_wrap.ml | ||
from | ||
(picos_mux.fifo -> stm_wrap.ocaml5.ml) | ||
(threads.posix -> stm_wrap.ocaml4.ml)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
open Picos | ||
|
||
let[@inline never] error entry _ = failwith entry | ||
|
||
let handler = | ||
let current fiber = fiber | ||
and spawn _ _ = error "spawn" | ||
and yield = error "yield" | ||
and cancel_after _ _ ~seconds:_ _ = error "cancel_after" | ||
and await _ t = | ||
while not (Trigger.is_signaled t) do | ||
Thread.yield () | ||
done; | ||
None | ||
in | ||
Handler.{ current; spawn; yield; cancel_after; await } | ||
|
||
let wrap_cmd_seq th = | ||
let result = ref (Error Exit) in | ||
Handler.using handler | ||
(Fiber.create ~forbid:false (Computation.create ())) | ||
(fun _fiber -> | ||
result := | ||
match th () with value -> Ok value | exception exn -> Error exn); | ||
match !result with Ok value -> value | Error exn -> raise exn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let wrap_cmd_seq th = | ||
let open Picos in | ||
let effc (type a) (e : a Effect.t) : | ||
((a, _) Effect.Deep.continuation -> _) option = | ||
match e with | ||
| Trigger.Await t -> | ||
Some | ||
(fun k -> | ||
while not (Trigger.is_signaled t) do | ||
Domain.cpu_relax () | ||
done; | ||
Effect.Deep.continue k None) | ||
| _ -> None | ||
in | ||
Effect.Deep.match_with th () { effc; exnc = raise; retc = Fun.id } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(library | ||
(package picos_meta) | ||
(name test_scheduler) | ||
(modules test_scheduler) | ||
(libraries | ||
(re_export picos) | ||
picos_io.select | ||
(select | ||
test_scheduler.ml | ||
from | ||
(picos.thread | ||
picos_lwt.unix | ||
picos_mux.random | ||
picos_mux.fifo | ||
picos_mux.multififo | ||
-> | ||
test_scheduler.ocaml5.ml) | ||
(picos_mux.thread lwt.unix -> test_scheduler.ocaml4.ml)))) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(library | ||
(package picos_meta) | ||
(name test_util) | ||
(modules test_util)) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters