aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/timers.go
diff options
context:
space:
mode:
authordeadprogram <[email protected]>2022-09-28 17:07:40 +0200
committerRon Evans <[email protected]>2022-09-28 21:55:37 +0200
commitc2fb1e776a8c9269e7bc2ec6a5f10c381eea7828 (patch)
tree526a0953bd7a9ce653487b9f154a3c122fa11023 /testdata/timers.go
parent895c54207612836c703f1f3744aac946e804bbb2 (diff)
downloadtinygo-c2fb1e776a8c9269e7bc2ec6a5f10c381eea7828.tar.gz
tinygo-c2fb1e776a8c9269e7bc2ec6a5f10c381eea7828.zip
testdata: increase timings used for timers test to try to avoid race condition errors on macOS CI
Signed-off-by: deadprogram <[email protected]>
Diffstat (limited to 'testdata/timers.go')
-rw-r--r--testdata/timers.go50
1 files changed, 25 insertions, 25 deletions
diff --git a/testdata/timers.go b/testdata/timers.go
index 13fb207be..ed3d4ca5b 100644
--- a/testdata/timers.go
+++ b/testdata/timers.go
@@ -4,51 +4,51 @@ import "time"
func main() {
// Test ticker.
- ticker := time.NewTicker(time.Millisecond * 250)
+ ticker := time.NewTicker(time.Millisecond * 500)
println("waiting on ticker")
go func() {
- time.Sleep(time.Millisecond * 125)
- println(" - after 125ms")
- time.Sleep(time.Millisecond * 250)
- println(" - after 375ms")
- time.Sleep(time.Millisecond * 250)
- println(" - after 625ms")
+ time.Sleep(time.Millisecond * 150)
+ println(" - after 150ms")
+ time.Sleep(time.Millisecond * 200)
+ println(" - after 200ms")
+ time.Sleep(time.Millisecond * 300)
+ println(" - after 300ms")
}()
<-ticker.C
- println("waited on ticker at 250ms")
- <-ticker.C
println("waited on ticker at 500ms")
+ <-ticker.C
+ println("waited on ticker at 1000ms")
ticker.Stop()
- time.Sleep(time.Millisecond * 500)
+ time.Sleep(time.Millisecond * 750)
select {
case <-ticker.C:
println("fail: ticker should have stopped!")
default:
- println("ticker was stopped (didn't send anything after 500ms)")
+ println("ticker was stopped (didn't send anything after 750ms)")
}
- timer := time.NewTimer(time.Millisecond * 250)
+ timer := time.NewTimer(time.Millisecond * 500)
println("waiting on timer")
go func() {
- time.Sleep(time.Millisecond * 125)
- println(" - after 125ms")
- time.Sleep(time.Millisecond * 250)
- println(" - after 250ms")
+ time.Sleep(time.Millisecond * 200)
+ println(" - after 200ms")
+ time.Sleep(time.Millisecond * 400)
+ println(" - after 400ms")
}()
<-timer.C
- println("waited on timer at 250ms")
- time.Sleep(time.Millisecond * 250)
+ println("waited on timer at 500ms")
+ time.Sleep(time.Millisecond * 500)
- reset := timer.Reset(time.Millisecond * 250)
+ reset := timer.Reset(time.Millisecond * 500)
println("timer reset:", reset)
println("waiting on timer")
go func() {
- time.Sleep(time.Millisecond * 125)
- println(" - after 125ms")
- time.Sleep(time.Millisecond * 250)
- println(" - after 250ms")
+ time.Sleep(time.Millisecond * 200)
+ println(" - after 200ms")
+ time.Sleep(time.Millisecond * 400)
+ println(" - after 400ms")
}()
<-timer.C
- println("waited on timer at 250ms")
- time.Sleep(time.Millisecond * 250)
+ println("waited on timer at 500ms")
+ time.Sleep(time.Millisecond * 500)
}