Skip to content

Commit c6729d9

Browse files
authored
Using multicore-magic-dscheck for dscheck tests (#143)
Add multicore-magic-dscheck to write dscheck tests on a data structure using Multicore-magic.
1 parent 17148d8 commit c6729d9

16 files changed

+38
-34
lines changed

dune-project

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,43 @@
77
(authors "KC Sivaramakrishnan")
88
(maintainers "Carine Morel" "KC Sivaramakrishnan" "Sudha Parimala")
99
(documentation "https://ocaml-multicore.github.io/saturn/")
10+
1011
(package
1112
(name saturn)
1213
(synopsis "Collection of parallelism-safe data structures for Multicore OCaml")
1314
(depends
1415
(ocaml (>= 4.13))
1516
(domain_shims (and (>= 0.1.0) :with-test))
1617
(saturn_lockfree (= :version))
17-
(multicore-magic (and (>= 2.1.0) :with-test))
18+
(multicore-magic (and (>= 2.3.0) :with-test))
1819
(multicore-bench (and (>= 0.1.2) :with-test))
20+
(multicore-magic-dscheck (and (>= 2.3.0) :with-test))
1921
(backoff (and (>= 0.1.0) :with-test))
2022
(alcotest (and (>= 1.7.0) :with-test))
2123
(qcheck (and (>= 0.21.3) :with-test))
2224
(qcheck-stm (and (>= 0.3) :with-test))
2325
(qcheck-alcotest (and (>= 0.21.3) :with-test))
2426
(yojson (and (>= 2.0.2) :with-test))
25-
(dscheck (and (>= 0.4.0) :with-test))
27+
(dscheck (and (>= 0.5.0) :with-test))
2628
(sherlodoc (and (>= 0.2) :with-doc))
2729
(odoc (and (>= 2.4.1) :with-doc))))
30+
2831
(package
2932
(name saturn_lockfree)
3033
(synopsis "Collection of lock-free data structures for Multicore OCaml")
3134
(depends
3235
(ocaml (>= 4.13))
3336
(domain_shims (and (>= 0.1.0) :with-test))
3437
(backoff (>= 0.1.0))
35-
(multicore-magic (>= 2.1.0))
38+
(multicore-magic (>= 2.3.0))
39+
(multicore-magic-dscheck (and (>= 2.3.0) :with-test))
3640
(alcotest (and (>= 1.7.0) :with-test))
3741
(qcheck (and (>= 0.21.3) :with-test))
3842
(qcheck-core (and (>= 0.21.3) :with-test))
3943
(qcheck-stm (and (>= 0.3) :with-test))
4044
(qcheck-multicoretests-util (and (>= 0.3) :with-test))
4145
(qcheck-alcotest (and (>= 0.21.3) :with-test))
4246
(yojson (and (>= 2.0.2) :with-test))
43-
(dscheck (and (>= 0.4.0) :with-test))
47+
(dscheck (and (>= 0.5.0) :with-test))
4448
(sherlodoc (and (>= 0.2) :with-doc))
4549
(odoc (and (>= 2.4.1) :with-doc))))

saturn.opam

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ depends: [
1313
"ocaml" {>= "4.13"}
1414
"domain_shims" {>= "0.1.0" & with-test}
1515
"saturn_lockfree" {= version}
16-
"multicore-magic" {>= "2.1.0" & with-test}
16+
"multicore-magic" {>= "2.3.0" & with-test}
1717
"multicore-bench" {>= "0.1.2" & with-test}
18+
"multicore-magic-dscheck" {>= "2.3.0" & with-test}
1819
"backoff" {>= "0.1.0" & with-test}
1920
"alcotest" {>= "1.7.0" & with-test}
2021
"qcheck" {>= "0.21.3" & with-test}
2122
"qcheck-stm" {>= "0.3" & with-test}
2223
"qcheck-alcotest" {>= "0.21.3" & with-test}
2324
"yojson" {>= "2.0.2" & with-test}
24-
"dscheck" {>= "0.4.0" & with-test}
25+
"dscheck" {>= "0.5.0" & with-test}
2526
"sherlodoc" {>= "0.2" & with-doc}
2627
"odoc" {>= "2.4.1" & with-doc}
2728
]

saturn_lockfree.opam

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ depends: [
1212
"ocaml" {>= "4.13"}
1313
"domain_shims" {>= "0.1.0" & with-test}
1414
"backoff" {>= "0.1.0"}
15-
"multicore-magic" {>= "2.1.0"}
15+
"multicore-magic" {>= "2.3.0"}
16+
"multicore-magic-dscheck" {>= "2.3.0" & with-test}
1617
"alcotest" {>= "1.7.0" & with-test}
1718
"qcheck" {>= "0.21.3" & with-test}
1819
"qcheck-core" {>= "0.21.3" & with-test}
1920
"qcheck-stm" {>= "0.3" & with-test}
2021
"qcheck-multicoretests-util" {>= "0.3" & with-test}
2122
"qcheck-alcotest" {>= "0.21.3" & with-test}
2223
"yojson" {>= "2.0.2" & with-test}
23-
"dscheck" {>= "0.4.0" & with-test}
24+
"dscheck" {>= "0.5.0" & with-test}
2425
"sherlodoc" {>= "0.2" & with-doc}
2526
"odoc" {>= "2.4.1" & with-doc}
2627
]

src_lockfree/size.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(** ⚠️ Beware that this implementation uses a bunch of low level data
1616
representation tricks to minimize overheads. *)
1717

18-
module Atomic = Transparent_atomic
18+
module Atomic = Multicore_magic.Transparent_atomic
1919

2020
let max_value = Int.max_int
2121

src_lockfree/skiplist.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
(* TODO: Grow and possibly shrink the skiplist or e.g. adjust search and node
2929
generation based on the dynamic number of bindings. *)
3030

31-
module Atomic = Transparent_atomic
31+
module Atomic = Multicore_magic.Transparent_atomic
3232

3333
(* OCaml doesn't allow us to use one of the unused (always 0) bits in pointers
3434
for the marks and an indirection is needed. This representation avoids the

src_lockfree/spsc_queue_unsafe.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* https://dl.acm.org/doi/pdf/10.1145/3437801.3441583
2323
*)
2424

25-
module Atomic = Transparent_atomic
25+
module Atomic = Multicore_magic.Transparent_atomic
2626

2727
type not_float = [ `Not_float of not_float ]
2828

src_lockfree/transparent_atomic.ml

-1
This file was deleted.

test/atomic/atomic.ml

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
include Dscheck.TracedAtomic
2-
3-
let make_contended = make

test/size/dscheck_size.ml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
module Atomic = Dscheck.TracedAtomic
12
open Linked_set.Make (Atomic) (Size)
23

34
let test_underflow_and_overflow () =

test/size/dune

+3-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@
1414
(modules dscheck_size size)
1515
(build_if
1616
(>= %{ocaml_version} 5))
17-
(libraries
18-
atomic
19-
transparent_atomic
20-
linked_set
21-
dscheck
22-
alcotest
23-
multicore-magic))
17+
(libraries dscheck linked_set alcotest multicore-magic-dscheck)
18+
(flags
19+
(:standard -open Multicore_magic_dscheck)))
2420

2521
(test
2622
(package saturn_lockfree)

test/skiplist/dscheck_skiplist.ml

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
open Skiplist
22

3+
module Atomic = Dscheck.TracedAtomic
4+
(** This is needed in this order as the skiplist.ml file contains
5+
{[
6+
module Atomic = Multicore_magic.Transparent_atomic
7+
]}
8+
which is in multicore-magic-dscheck library only a subset of [Dscheck.TracedAtomic] function.
9+
*)
10+
311
let test_max_height_of () =
412
let s = create ~max_height:1 ~compare () in
513
assert (max_height_of s = 1);

test/skiplist/dune

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
(modules skiplist size dscheck_skiplist)
1212
(build_if
1313
(>= %{ocaml_version} 5))
14-
(libraries atomic transparent_atomic dscheck alcotest multicore-magic))
14+
(libraries alcotest dscheck multicore-magic-dscheck)
15+
(flags
16+
(:standard -open Multicore_magic_dscheck)))
1517

1618
(test
1719
(package saturn_lockfree)

test/spsc_queue/dune

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
(test
1717
(package saturn_lockfree)
1818
(name spsc_queue_dscheck)
19-
(libraries atomic dscheck alcotest multicore-magic transparent_atomic)
19+
(libraries alcotest atomic dscheck multicore-magic-dscheck)
2020
(build_if
2121
(>= %{ocaml_version} 5))
22-
(modules spsc_queue spsc_queue_unsafe spsc_queue_intf spsc_queue_dscheck))
22+
(modules spsc_queue spsc_queue_unsafe spsc_queue_intf spsc_queue_dscheck)
23+
(flags
24+
(:standard -open Multicore_magic_dscheck)))
2325

2426
(test
2527
(package saturn_lockfree)

test/spsc_queue/spsc_queue_dscheck.ml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module Atomic = Dscheck.TracedAtomic
2+
13
module Dscheck_spsc (Spsc_queue : Spsc_queue_intf.SPSC_queue) = struct
24
let create_test ~shift_by () =
35
let queue = Spsc_queue.create ~size_exponent:2 in

test/transparent_atomic/dune

-5
This file was deleted.

test/transparent_atomic/transparent_atomic.ml

-5
This file was deleted.

0 commit comments

Comments
 (0)