Skip to content

Commit 73033b7

Browse files
authored
Merge pull request #452 from ocaml-multicore/bigarray-stm-tests
Reenable Bigarray STM tests
2 parents 70a0671 + e9421bb commit 73033b7

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

src/bigarray/dune

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
(modules stm_tests)
66
(package multicoretests)
77
(libraries qcheck-stm.sequential qcheck-stm.domain)
8-
; (action (run %{test} --verbose))
9-
(action (echo "Skipping src/bigarray/%{test} from the test suite\n\n"))
8+
(action (run %{test} --verbose))
109
)
1110

1211
(test

src/bigarray/lin_tests.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ module BA1T = Lin_domain.Make(BA1Conf)
2929

3030
let _ =
3131
QCheck_base_runner.run_tests_main [
32-
BA1T.neg_lin_test ~count:5000 ~name:"Lin Bigarray.Array1 (of ints) test with Domain";
3332
BA1T.stress_test ~count:1000 ~name:"Lin Bigarray.Array1 stress test with Domain";
3433
]

src/bigarray/stm_tests.ml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ struct
5757
Array1.fill ba 0 ;
5858
ba
5959

60-
let cleanup _ = ()
60+
let cleanup _ = ()
6161

62-
let precond n _s = match n with
63-
| _ -> true
62+
let precond _n _s = true
6463

6564
let run n ba = match n with
6665
| Size_in_bytes -> Res (STM.int, Array1.size_in_bytes ba)
@@ -70,16 +69,18 @@ struct
7069
(* | Sub (i,l) -> Res (result (array char) exn, protect (Array.sub a i) l) *)
7170
| Fill n -> Res (result unit exn, protect (Array1.fill ba) n)
7271

72+
let word_size_in_bytes = Sys.word_size / 8
73+
7374
let postcond n (s:int list) res = match n, res with
74-
| Size_in_bytes, Res ((Int,_),i) -> i = 8 * (List.length s)
75+
| Size_in_bytes, Res ((Int,_),r) -> r = word_size_in_bytes * (List.length s)
7576
| Get i, Res ((Result (Int,Exn),_), r) ->
7677
if i < 0 || i >= List.length s
77-
then r = Error (Invalid_argument "index out of bounds")
78-
else r = Ok (List.nth s i)
78+
then r = Error (Invalid_argument "index out of bounds")
79+
else r = Ok (List.nth s i)
7980
| Set (i,_), Res ((Result (Unit,Exn),_), r) ->
8081
if i < 0 || i >= List.length s
81-
then r = Error (Invalid_argument "index out of bounds")
82-
else r = Ok ()
82+
then r = Error (Invalid_argument "index out of bounds")
83+
else r = Ok ()
8384
(* STM don't support bigarray type for the moment*)
8485
(* | Sub (i,l), Res ((Result (Array Char,Exn),_), r) ->
8586
if i < 0 || l < 0 || i+l > List.length s
@@ -92,8 +93,7 @@ end
9293
module BigArraySTM_seq = STM_sequential.Make(BAConf)
9394
module BigArraySTM_dom = STM_domain.Make(BAConf)
9495
;;
95-
QCheck_base_runner.run_tests_main
96-
(let count = 1000 in
97-
[BigArraySTM_seq.agree_test ~count ~name:"STM BigArray test sequential";
98-
BigArraySTM_dom.neg_agree_test_par ~count ~name:"STM BigArray test parallel"
99-
])
96+
QCheck_base_runner.run_tests_main [
97+
BigArraySTM_seq.agree_test ~count:1000 ~name:"STM BigArray test sequential";
98+
BigArraySTM_dom.neg_agree_test_par ~count:5000 ~name:"STM BigArray test parallel"
99+
]

0 commit comments

Comments
 (0)