Skip to content
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

Split Lin package #164

Merged
merged 6 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/array/dune
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(name lin_tests)
(modules lin_tests)
(flags (:standard -w -27))
(libraries lin)
(libraries qcheck-lin.domain)
(preprocess (pps ppx_deriving_qcheck ppx_deriving.show ppx_deriving.eq)))

; (rule
Expand All @@ -37,7 +37,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain))

(rule
(alias runtest)
Expand Down
4 changes: 2 additions & 2 deletions src/array/lin_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ struct
let cleanup _ = ()
end

module AT = Lin.Make(AConf)
module AT_domain = Lin_domain.Make_internal(AConf)
;;
QCheck_base_runner.run_tests_main [
AT.neg_lin_test `Domain ~count:1000 ~name:"Lin Array test with Domain";
AT_domain.neg_lin_test ~count:1000 ~name:"Lin Array test with Domain";
]
6 changes: 3 additions & 3 deletions src/array/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct
let init () = Array.make array_size 'a'
let cleanup _ = ()

open Lin_api
open Lin_base
let int,char = nat_small,char_printable
let array_to_seq a = List.to_seq (List.of_seq (Array.to_seq a)) (* workaround: Array.to_seq is lazy and will otherwise see and report later Array.set state changes... *)
let api =
Expand All @@ -26,8 +26,8 @@ struct
]
end

module AT = Lin_api.Make(AConf)
module AT_domain = Lin_domain.Make(AConf)
;;
QCheck_base_runner.run_tests_main [
AT.neg_lin_test `Domain ~count:1000 ~name:"Lin_api Array test with Domain";
AT_domain.neg_lin_test ~count:1000 ~name:"Lin_api Array test with Domain";
]
4 changes: 2 additions & 2 deletions src/atomic/dune
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(name lin_tests)
(modules lin_tests)
(flags (:standard -w -27))
(libraries lin)
(libraries qcheck-lin.domain)
(preprocess (pps ppx_deriving_qcheck ppx_deriving.show ppx_deriving.eq)))

; (rule
Expand All @@ -43,7 +43,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain))

(rule
(alias runtest)
Expand Down
8 changes: 4 additions & 4 deletions src/atomic/lin_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct
let cleanup _ = ()
end

module AT = Lin.Make(AConf)
module AT_domain = Lin_domain.Make_internal(AConf)

(** A variant of the above with 3 Atomics *)
module A3Conf =
Expand Down Expand Up @@ -85,9 +85,9 @@ struct
let cleanup _ = ()
end

module A3T = Lin.Make(A3Conf)
module A3T_domain = Lin_domain.Make_internal(A3Conf)
;;
QCheck_base_runner.run_tests_main [
AT.lin_test `Domain ~count:1000 ~name:"Lin Atomic test with Domain";
A3T.lin_test `Domain ~count:1000 ~name:"Lin Atomic3 test with Domain";
AT_domain.lin_test ~count:1000 ~name:"Lin Atomic test with Domain";
A3T_domain.lin_test ~count:1000 ~name:"Lin Atomic3 test with Domain";
]
8 changes: 4 additions & 4 deletions src/atomic/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Atomic_spec : Lin_api.ApiSpec = struct
open Lin_api (* FIXME add Gen.nat *)
module Atomic_spec : Lin_base.ApiSpec = struct
open Lin_base (* FIXME add Gen.nat *)
type t = int Atomic.t
let init () = Atomic.make 0
let cleanup _ = ()
Expand All @@ -13,9 +13,9 @@ module Atomic_spec : Lin_api.ApiSpec = struct
val_ "Atomic.decr" Atomic.decr (t @-> returning unit) ]
end

module Lin_atomic = Lin_api.Make (Atomic_spec)
module Lin_atomic_domain = Lin_domain.Make (Atomic_spec)

let () =
QCheck_base_runner.run_tests_main
[ Lin_atomic.lin_test `Domain ~count:1000 ~name:"Lin_api Atomic test with Domain";
[ Lin_atomic_domain.lin_test ~count:1000 ~name:"Lin_api Atomic test with Domain";
]
2 changes: 1 addition & 1 deletion src/bigarray/dune
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain))

(executable
(name stm_tests)
Expand Down
6 changes: 3 additions & 3 deletions src/bigarray/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct
arr
let cleanup _ = ()

open Lin_api
open Lin_base
let int = int_small

let api =
Expand All @@ -25,9 +25,9 @@ struct
]
end

module BA1T = Lin_api.Make(BA1Conf)
module BA1T = Lin_domain.Make(BA1Conf)

let _ =
QCheck_base_runner.run_tests_main [
BA1T.neg_lin_test `Domain ~count:5000 ~name:"Lin_api Bigarray.Array1 (of ints) test with Domain";
BA1T.neg_lin_test ~count:5000 ~name:"Lin_api Bigarray.Array1 (of ints) test with Domain";
]
2 changes: 1 addition & 1 deletion src/bytes/dune
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain qcheck-lin.thread))

(executable
(name stm_tests)
Expand Down
10 changes: 6 additions & 4 deletions src/bytes/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module BConf = struct
let init () = Stdlib.Bytes.make 42 '0'
let cleanup _ = ()

open Lin_api
open Lin_base

let api = [
val_ "Bytes.get" Bytes.get (t @-> int @-> returning_or_exc char);
val_ "Bytes.sub_string" Bytes.sub_string (t @-> int @-> int @-> returning_or_exc string);
Expand All @@ -16,9 +17,10 @@ module BConf = struct
val_ "Bytes.index_from" Bytes.index_from (t @-> int @-> char @-> returning_or_exc int)]
end

module BT = Lin_api.Make(BConf)
module BT_domain = Lin_domain.Make(BConf)
module BT_thread = Lin_thread.Make(BConf)
;;
QCheck_base_runner.run_tests_main [
BT.lin_test `Domain ~count:1000 ~name:"Lin_api Bytes test with Domain";
BT.lin_test `Thread ~count:1000 ~name:"Lin_api Bytes test with Thread";
BT_domain.lin_test ~count:1000 ~name:"Lin_api Bytes test with Domain";
BT_thread.lin_test ~count:1000 ~name:"Lin_api Bytes test with Thread";
]
2 changes: 1 addition & 1 deletion src/ephemeron/dune
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain qcheck-lin.thread))

(rule
(alias runtest)
Expand Down
9 changes: 5 additions & 4 deletions src/ephemeron/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module EConf =
let init () = E.create 42
let cleanup _ = ()

open Lin_api
open Lin_base
let int,string = nat_small, string_small_printable
let api =
[ val_ "Ephemeron.clear" E.clear (t @-> returning unit);
Expand All @@ -38,9 +38,10 @@ module EConf =
]
end

module ET = Lin_api.Make(EConf)
module ET_domain = Lin_domain.Make(EConf)
module ET_thread = Lin_thread.Make(EConf)
;;
QCheck_base_runner.run_tests_main [
ET.neg_lin_test `Domain ~count:1000 ~name:"Lin_api Ephemeron test with Domain";
ET.lin_test `Thread ~count:250 ~name:"Lin_api Ephemeron test with Thread";
ET_domain.neg_lin_test ~count:1000 ~name:"Lin_api Ephemeron test with Domain";
ET_thread.lin_test ~count:250 ~name:"Lin_api Ephemeron test with Thread";
]
2 changes: 1 addition & 1 deletion src/floatarray/dune
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain))

(rule
(alias runtest)
Expand Down
6 changes: 3 additions & 3 deletions src/floatarray/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct
let init () = Float.Array.make array_size 0.0
let cleanup _ = ()

open Lin_api
open Lin_base
let int = int_small

(* fully evaluate the iterator, otherwise we get too many
Expand All @@ -33,9 +33,9 @@ struct
]
end

module FAT = Lin_api.Make(FAConf)
module FAT = Lin_domain.Make(FAConf)

let _ =
QCheck_base_runner.run_tests_main [
FAT.neg_lin_test `Domain ~count:1000 ~name:"Lin_api Float.Array test with Domain";
FAT.neg_lin_test ~count:1000 ~name:"Lin_api Float.Array test with Domain";
]
4 changes: 2 additions & 2 deletions src/hashtbl/dune
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(name lin_tests)
(modules lin_tests)
(flags (:standard -w -27))
(libraries lin)
(libraries qcheck-lin.domain)
(preprocess (pps ppx_deriving_qcheck ppx_deriving.show ppx_deriving.eq)))

; (rule
Expand All @@ -37,7 +37,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain))

(rule
(alias runtest)
Expand Down
6 changes: 3 additions & 3 deletions src/hashtbl/lin_tests.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open QCheck
open Lin
open Lin_base.Lin_internal

(** ********************************************************************** *)
(** Tests of thread-unsafe [Hashtbl] *)
Expand Down Expand Up @@ -65,8 +65,8 @@ struct
let cleanup _ = ()
end

module HT = Lin.Make(HConf)
module HT_domain = Lin_domain.Make_internal(HConf)
;;
QCheck_base_runner.run_tests_main [
HT.neg_lin_test `Domain ~count:1000 ~name:"Lin Hashtbl test with Domain";
HT_domain.neg_lin_test ~count:1000 ~name:"Lin Hashtbl test with Domain";
]
8 changes: 4 additions & 4 deletions src/hashtbl/lin_tests_dsl.ml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(* ********************************************************************** *)
(* Tests of thread-unsafe [Hashtbl] *)
(* ********************************************************************** *)
module HConf (*: Lin_api.ApiSpec*) =
module HConf (*: Lin_base.ApiSpec*) =
struct
type t = (char, int) Hashtbl.t

let init () = Hashtbl.create ~random:false 42
let cleanup _ = ()

open Lin_api
open Lin_base
let int,char = nat_small,char_printable
let api =
[ val_ "Hashtbl.clear" Hashtbl.clear (t @-> returning unit);
Expand All @@ -23,8 +23,8 @@ struct
]
end

module HT = Lin_api.Make(HConf)
module HT_domain = Lin_domain.Make(HConf)
;;
QCheck_base_runner.run_tests_main [
HT.neg_lin_test `Domain ~count:1000 ~name:"Lin_api Hashtbl test with Domain";
HT_domain.neg_lin_test ~count:1000 ~name:"Lin_api Hashtbl test with Domain";
]
2 changes: 1 addition & 1 deletion src/internal/cleanup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct
| Add i -> (let old = !r in r := i + old; RAdd) (* buggy: not atomic *)
end

module RT = Lin.Make(RConf)
module RT = Lin_domain.Make_internal(RConf)
;;
Test.check_exn
(let seq_len,par_len = 20,15 in
Expand Down
4 changes: 2 additions & 2 deletions src/internal/dune
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(executable
(name util_print_test)
(modules util_print_test)
(libraries lin))
(libraries qcheck-multicoretests-util))

(rule
(alias runtest)
Expand All @@ -21,7 +21,7 @@
(executable
(name cleanup)
(modules cleanup)
(libraries lin)
(libraries qcheck-lin.domain)
(preprocess (pps ppx_deriving.show ppx_deriving.eq)))

(rule
Expand Down
4 changes: 2 additions & 2 deletions src/lazy/dune
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(executable
(name lin_tests)
(modules lin_tests)
(libraries lin)
(libraries qcheck-lin.domain)
(preprocess (pps ppx_deriving_qcheck ppx_deriving.show ppx_deriving.eq)))

; (rule
Expand All @@ -36,7 +36,7 @@
(executable
(name lin_tests_dsl)
(modules lin_tests_dsl)
(libraries lin))
(libraries qcheck-lin.domain))

; (rule
; (alias runtest)
Expand Down
14 changes: 7 additions & 7 deletions src/lazy/lin_tests.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open QCheck
open Lin

(** parallel linearization tests of Lazy *)

Expand Down Expand Up @@ -33,6 +32,7 @@ module Lazy :

module LBase =
struct
open Lin_base.Lin_internal
type cmd =
| Force
| Force_val
Expand Down Expand Up @@ -75,22 +75,22 @@ struct
end


module LTlazy = Lin.Make(struct
module LTlazy = Lin_domain.Make_internal(struct
include LBase
let init () = lazy (work ())
end)
module LTfromval = Lin.Make(struct
module LTfromval = Lin_domain.Make_internal(struct
include LBase
let init () = Lazy.from_val 42
end)
module LTfromfun = Lin.Make(struct
module LTfromfun = Lin_domain.Make_internal(struct
include LBase
let init () = Lazy.from_fun work
end)
;;
QCheck_base_runner.run_tests_main
(let count = 100 in
[LTlazy.neg_lin_test `Domain ~count ~name:"Lin Lazy test with Domain";
LTfromval.lin_test `Domain ~count ~name:"Lin Lazy test with Domain from_val";
LTfromfun.neg_lin_test `Domain ~count ~name:"Lin Lazy test with Domain from_fun";
[LTlazy.neg_lin_test ~count ~name:"Lin Lazy test with Domain";
LTfromval.lin_test ~count ~name:"Lin Lazy test with Domain from_val";
LTfromfun.neg_lin_test ~count ~name:"Lin Lazy test with Domain from_fun";
])
Loading