Skip to content

Commit 2d9834c

Browse files
committed
Reduce test failures(too short sleep time). Add paralleltest.sh for concurrent testings (10 parallel, total 1000)
1 parent f7f4392 commit 2d9834c

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

paralleltest.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Usages Ref:
3+
# ./paralleltest.sh 2>&1 | grep failed
4+
# ./paralleltest.sh 2>&1 | grep "assertion failed"
5+
# ./paralleltest.sh 2>&1 | grep "src/actor.rs"
6+
7+
for i in $(seq 1 1000)
8+
do
9+
( ./test.sh ) &
10+
if (( $i % 10 == 0 )); then wait; fi # Limit to 10 concurrent subshells.
11+
done
12+
wait

src/actor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ fn test_actor_common() {
399399
// Send Shutdown
400400
root_handle.send(Value::Shutdown);
401401

402-
thread::sleep(Duration::from_millis(2));
402+
thread::sleep(Duration::from_millis(10));
403403
// 3 children Actors
404404
assert_eq!(3, result_string.pop_front().unwrap().len());
405405

@@ -463,7 +463,7 @@ fn test_actor_ask() {
463463
root_handle.send(Value::AskIntByLinkedListAsync((1, result_i32.clone())));
464464
root_handle.send(Value::AskIntByLinkedListAsync((2, result_i32.clone())));
465465
root_handle.send(Value::AskIntByLinkedListAsync((3, result_i32.clone())));
466-
thread::sleep(Duration::from_millis(1));
466+
thread::sleep(Duration::from_millis(5));
467467
let i = result_i32.pop_front();
468468
assert_eq!(Some(10), i);
469469
let i = result_i32.pop_front();
@@ -477,7 +477,7 @@ fn test_actor_ask() {
477477
root_handle.send(Value::AskIntByBlockingQueue((4, result_i32.clone())));
478478
root_handle.send(Value::AskIntByBlockingQueue((5, result_i32.clone())));
479479
root_handle.send(Value::AskIntByBlockingQueue((6, result_i32.clone())));
480-
thread::sleep(Duration::from_millis(2));
480+
thread::sleep(Duration::from_millis(5));
481481
let i = result_i32.take();
482482
assert_eq!(Some(40), i);
483483
let i = result_i32.take();

0 commit comments

Comments
 (0)