File tree Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,22 @@ module Make_internal (Spec : Internal.CmdSpec [@alert "-internal"]) = struct
5454
5555 let neg_lin_test ~count ~name =
5656 neg_lin_test ~rep_count: 100 ~count ~retries: 5 ~name ~lin_prop: lin_prop
57+
58+ let lin_stats ~count =
59+ let rep_count = 25 in
60+ let seq_len,par_len = 20 ,12 in
61+ let exceptions = ref 0 in
62+ let t =
63+ QCheck.Test. make ~count
64+ (arb_cmds_triple seq_len par_len)
65+ (fun triple ->
66+ try (* On purpose we include repetition, because triggering issue is very rare *)
67+ Util. repeat rep_count lin_prop triple
68+ with _ ->
69+ incr exceptions;
70+ true ) in
71+ QCheck.Test. check_exn t;
72+ ! exceptions
5773end
5874
5975module Make (Spec : Spec ) = Make_internal (MakeCmd (Spec ))
Original file line number Diff line number Diff line change @@ -43,4 +43,10 @@ module Make (Spec : Spec) : sig
4343 is found, and succeeds if a counter example is indeed found, and prints it
4444 afterwards.
4545 *)
46+
47+ val lin_stats : count :int -> int
48+ (* * Repeatedly run a concurrent test based on {!Stdlib.Thread} and
49+ return how many times sequential consistency failed.
50+ Accepts a labeled parameter:
51+ [count] is the number of test iterations. *)
4652end
Original file line number Diff line number Diff line change 118118 (action (progn))
119119)
120120
121+ (executable
122+ (name lin_tests_thread_stats)
123+ (modules lin_tests_thread_stats)
124+ (flags (:standard -w -27))
125+ (libraries lin_tests_common qcheck-lin.thread)
126+ (modes native byte)
127+ )
128+
121129(test
122130 (name lin_tests_effect)
123131 (modules lin_tests_effect)
Original file line number Diff line number Diff line change 1+ open Lin_tests_common
2+
3+ (* * This is a driver of the negative tests over the Thread module *)
4+
5+ module CList_bis = struct include CList let add_node = add_node_thread end
6+ module RT_int_thread = Lin_thread. Make (Ref_int_spec )
7+ module RT_int64_thread = Lin_thread. Make (Ref_int64_spec )
8+ module CLT_int_thread = Lin_thread. Make (CList_spec_int (CList_bis ))
9+ module CLT_int64_thread = Lin_thread. Make (CList_spec_int64 (CList_bis ))
10+
11+ let count = 10000
12+
13+ let failures = RT_int_thread. lin_stats ~count
14+ let () = Printf. printf " Lin int ref Thread %i / %i\n %!" failures count
15+
16+ let failures = RT_int64_thread. lin_stats ~count
17+ let () = Printf. printf " Lin int64 ref Thread %i / %i\n %!" failures count
18+
19+ let failures = CLT_int_thread. lin_stats ~count
20+ let () = Printf. printf " Lin int CList Thread %i / %i\n %!" failures count
21+
22+ let failures = CLT_int64_thread. lin_stats ~count
23+ let () = Printf. printf " Lin int64 CList Thread %i / %i\n %!" failures count
You can’t perform that action at this time.
0 commit comments