Skip to content

Commit ffab518

Browse files
committed
Generate less nodes in 32-bit architectures
In 32-bit architectures, the bounds on the number of domains and threads that can be spawned is much lower that on 64-bit architectures (due to the much smaller virtual space and the hard limit set on the number of simultaneous domains), so adjust tests accordingly
1 parent 9b54c59 commit ffab518

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

src/domain/domain_joingraph.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,12 @@ let test_atomic_work ~domain_bound =
157157
(*Printf.printf "main domain %i -- joining %s success\n%!" (Domain.self () :> int) tgt_id*)
158158
) ps;
159159
Atomic.get a = test_input.num_domains)
160+
161+
let bound_tak = if Sys.word_size == 64 then 100 else 8
162+
let bound_atomic = if Sys.word_size == 64 then 250 else 8
163+
160164
;;
161165
QCheck_base_runner.run_tests_main
162-
[test_tak_work ~domain_bound:100(*8*);
163-
test_atomic_work ~domain_bound:250(*8*)
166+
[test_tak_work ~domain_bound:bound_tak;
167+
test_atomic_work ~domain_bound:bound_atomic
164168
]

src/domain/domain_spawntree.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,11 @@ let t ~max_height ~max_degree = Test.make
8484
then true
8585
else (Printf.printf "Failure \"%s\"\n%!" s; false)
8686
))
87+
88+
let test =
89+
if Sys.word_size == 64
90+
then t ~max_height:5 ~max_degree:10
91+
else t ~max_height:3 ~max_degree:3
92+
8793
;;
88-
QCheck_base_runner.run_tests_main [t ~max_height:5 ~max_degree:10]
94+
QCheck_base_runner.run_tests_main [test]

src/thread/thread_createtree.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,11 @@ let t ~max_height ~max_degree = Test.make
7373
let a = Atomic.make 0 in
7474
let () = thread_interp a c in
7575
Atomic.get a = interp 0 c)
76+
77+
let test =
78+
if Sys.word_size == 64
79+
then t ~max_height:5 ~max_degree:10
80+
else t ~max_height:3 ~max_degree:3
81+
7682
;;
77-
QCheck_base_runner.run_tests_main [t ~max_height:5 ~max_degree:10]
83+
QCheck_base_runner.run_tests_main [test]

src/thread/thread_joingraph.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,12 @@ let test_atomic_work ~thread_bound =
116116
Thread.join p;
117117
) ps;
118118
Atomic.get a = test_input.num_threads)
119+
120+
let bound_tak = if Sys.word_size == 64 then 100 else 16
121+
let bound_atomic = if Sys.word_size == 64 then 250 else 16
122+
119123
;;
120124
QCheck_base_runner.run_tests_main
121-
[test_tak_work ~thread_bound:100(*8*);
122-
test_atomic_work ~thread_bound:250(*8*)
125+
[test_tak_work ~thread_bound:bound_tak;
126+
test_atomic_work ~thread_bound:bound_atomic
123127
]

src/threadomain/threadomain.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,14 @@ let run_all_nodes sj =
160160
Array.for_all (fun h -> h = NoHdl) hdls.handles
161161
&& Atomic.get global = sz
162162

163+
let nb_nodes =
164+
let max = if Sys.word_size == 64 then 100 else 16 in
165+
Gen.int_range 2 max
166+
163167
let main_test = Test.make ~name:"Mash up of threads and domains"
164168
~count:500
165169
~print:show_spawn_join
166-
(Gen.sized_size (Gen.int_range 2 100) gen_spawn_join)
170+
(Gen.sized_size nb_nodes gen_spawn_join)
167171
run_all_nodes
168172
(* to debug deadlocks: *)
169173
(* (Util.fork_prop_with_timeout 1 run_all_nodes) *)

0 commit comments

Comments
 (0)