Skip to content

Commit fa739c1

Browse files
committed
Reduce test iteration counts and print OK
It seems tests sometimes timeout on CI. Even with smaller iteration counts it is likely that the tests will catch the relevant problems and in case of a failure on can then locally increase the counts to reproduce issues.
1 parent 3c0f21c commit fa739c1

File tree

10 files changed

+30
-15
lines changed

10 files changed

+30
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ using a transaction:
15781578

15791579
```ocaml
15801580
# with_updater @@ fun () ->
1581-
for _ = 1 to 10_000 do
1581+
for _ = 1 to 1_000 do
15821582
let tx ~xt =
15831583
0 = (Xt.get ~xt a + Xt.get ~xt b)
15841584
in
@@ -1600,7 +1600,7 @@ experiment where we abort the transaction in case we observe that the values of
16001600
<!-- $MDX skip -->
16011601
```ocaml
16021602
# with_updater @@ fun () ->
1603-
for _ = 1 to 10_000 do
1603+
for _ = 1 to 1_000 do
16041604
let tx ~xt =
16051605
if 0 <> (Xt.get ~xt a + Xt.get ~xt b) then
16061606
failwith "torn read"

test/example.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ ignore (Kcas.Op.atomically kcas);
99

1010
(* atomic_1 = 1, atomic_2 = 4 *)
1111
assert (Kcas.Loc.get atomic_1 = 1);
12-
assert (Kcas.Loc.get atomic_2 = 4)
12+
assert (Kcas.Loc.get atomic_2 = 4);
13+
14+
Printf.printf "Example OK!\n%!"

test/kcas_data/hashtbl_test.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,5 @@ let () =
8888
Hashtbl.remove t "foo";
8989
assert (Hashtbl.length t = 1);
9090
assert (Hashtbl.to_seq t |> List.of_seq |> List.sort compare = [ ("bar", 19) ])
91+
92+
let () = Printf.printf "Test Hashtbl OK!\n%!"

test/kcas_data/queue_test.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ let () =
3030
assert (Queue.take_opt q = None);
3131
assert (Queue.take_opt r = Some 101);
3232
assert (Queue.take_opt r = Some 42);
33-
assert (Queue.take_opt r = None)
33+
assert (Queue.take_opt r = None);
34+
35+
Printf.printf "Test Queue OK!\n%!"

test/kcas_data/stack_test.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ let () =
1818
assert (Stack.length t = 2);
1919
assert (Stack.pop_opt t = Some 42);
2020
assert (Stack.pop_opt t = Some 101);
21-
assert (Stack.pop_opt t = None)
21+
assert (Stack.pop_opt t = None);
22+
23+
Printf.printf "Test Stack OK!\n%!"

test/ms_queue_test.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ let tail_leak_test n =
123123
List.init m domain |> List.map Domain.spawn |> List.iter Domain.join
124124

125125
let () =
126-
let n = try int_of_string Sys.argv.(1) with _ -> 100_000 in
126+
let n = try int_of_string Sys.argv.(1) with _ -> 1_000 in
127127
write_skew_test n;
128128
tail_leak_test n;
129-
()
129+
Printf.printf "Test MS queue OK!\n%!"

test/test.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let assert_kcas loc expected_v =
3434

3535
let test_non_linearizable () =
3636
let barrier = Barrier.make 2
37-
and n_iter = 1_000_000
37+
and n_iter = 100_000
3838
and test_finished = ref false in
3939

4040
let a = Loc.make 0 and b = Loc.make 0 in
@@ -208,7 +208,7 @@ let in_place_shuffle array =
208208
done
209209

210210
let test_presort () =
211-
let n_incs = 50_000 and n_domains = 3 and n_locs = 5 in
211+
let n_incs = 10_000 and n_domains = 3 and n_locs = 5 in
212212

213213
let barrier = Barrier.make n_domains in
214214

@@ -240,7 +240,7 @@ let test_presort () =
240240
(* *)
241241

242242
let test_presort_and_is_in_log_xt () =
243-
let n_incs = 50_000 and n_domains = 3 and n_locs = 12 in
243+
let n_incs = 10_000 and n_domains = 3 and n_locs = 12 in
244244
let n_locs_half = n_locs asr 1 in
245245

246246
let barrier = Barrier.make n_domains in
@@ -482,7 +482,7 @@ let () =
482482
test_set ();
483483
test_casn ();
484484
test_read_casn ();
485-
test_stress 1000 10000;
485+
test_stress 1_000 1_000;
486486
test_presort ();
487487
test_presort_and_is_in_log_xt ();
488488
test_updates ();
@@ -491,7 +491,8 @@ let () =
491491
test_blocking ();
492492
test_no_unnecessary_wakeups ();
493493
test_validation ();
494-
test_xt ()
494+
test_xt ();
495+
Printf.printf "Test suite OK!\n%!"
495496

496497
(*
497498
####

test/test_overlapping_loc.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ let test_3 () =
4949
let _ =
5050
test_1 ();
5151
test_2 ();
52-
test_3 ()
52+
test_3 ();
53+
54+
Printf.printf "Test overlapping loc OK!\n%!"

test/threads.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ let () =
1616

1717
Thread.join a_thread;
1818

19-
assert (Loc.get x + Loc.get y = 42)
19+
assert (Loc.get x + Loc.get y = 42);
20+
21+
Printf.printf "Test threads OK!\n%!"

test/xt_test.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ let () =
3333
assert (Xt.commit { tx = P.Xt.is_empty p });
3434

3535
Xt.commit { tx = Q.push_front q 101 };
36-
assert (not (Xt.commit { tx = Q.is_empty q }))
36+
assert (not (Xt.commit { tx = Q.is_empty q }));
37+
38+
Printf.printf "Test Xt OK!\n%!"

0 commit comments

Comments
 (0)