aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorKenneth Bell <[email protected]>2022-07-02 17:19:36 +0100
committerRon Evans <[email protected]>2022-08-24 11:05:40 +0200
commit12d63d96420c582b5dffc2bea58e6569022d155d (patch)
treecf68f260dd43c7e9582088b0304412381b30dadc /testdata
parent24b45555bd9c82a5486f3063b32c262bfa420253 (diff)
downloadtinygo-12d63d96420c582b5dffc2bea58e6569022d155d.tar.gz
tinygo-12d63d96420c582b5dffc2bea58e6569022d155d.zip
runtime: improve reliability of timers test in CI
Diffstat (limited to 'testdata')
-rw-r--r--testdata/timers.go36
-rw-r--r--testdata/timers.txt18
2 files changed, 27 insertions, 27 deletions
diff --git a/testdata/timers.go b/testdata/timers.go
index 99591c822..d412abc86 100644
--- a/testdata/timers.go
+++ b/testdata/timers.go
@@ -4,38 +4,38 @@ import "time"
func main() {
// Test ticker.
- ticker := time.NewTicker(time.Millisecond * 160)
+ ticker := time.NewTicker(time.Millisecond * 250)
println("waiting on ticker")
go func() {
- time.Sleep(time.Millisecond * 80)
- println(" - after 80ms")
- time.Sleep(time.Millisecond * 160)
- println(" - after 240ms")
- time.Sleep(time.Millisecond * 160)
- println(" - after 400ms")
+ time.Sleep(time.Millisecond * 125)
+ println(" - after 125ms")
+ time.Sleep(time.Millisecond * 250)
+ println(" - after 375ms")
+ time.Sleep(time.Millisecond * 250)
+ println(" - after 625ms")
}()
<-ticker.C
- println("waited on ticker at 160ms")
+ println("waited on ticker at 250ms")
<-ticker.C
- println("waited on ticker at 320ms")
+ println("waited on ticker at 500ms")
ticker.Stop()
- time.Sleep(time.Millisecond * 400)
+ time.Sleep(time.Millisecond * 500)
select {
case <-ticker.C:
println("fail: ticker should have stopped!")
default:
- println("ticker was stopped (didn't send anything after 400ms)")
+ println("ticker was stopped (didn't send anything after 500ms)")
}
- timer := time.NewTimer(time.Millisecond * 160)
+ timer := time.NewTimer(time.Millisecond * 250)
println("waiting on timer")
go func() {
- time.Sleep(time.Millisecond * 80)
- println(" - after 80ms")
- time.Sleep(time.Millisecond * 160)
- println(" - after 240ms")
+ time.Sleep(time.Millisecond * 125)
+ println(" - after 125ms")
+ time.Sleep(time.Millisecond * 250)
+ println(" - after 250ms")
}()
<-timer.C
- println("waited on timer at 160ms")
- time.Sleep(time.Millisecond * 160)
+ println("waited on timer at 250ms")
+ time.Sleep(time.Millisecond * 250)
}
diff --git a/testdata/timers.txt b/testdata/timers.txt
index 24142d541..783c402c2 100644
--- a/testdata/timers.txt
+++ b/testdata/timers.txt
@@ -1,11 +1,11 @@
waiting on ticker
- - after 80ms
-waited on ticker at 160ms
- - after 240ms
-waited on ticker at 320ms
- - after 400ms
-ticker was stopped (didn't send anything after 400ms)
+ - after 125ms
+waited on ticker at 250ms
+ - after 375ms
+waited on ticker at 500ms
+ - after 625ms
+ticker was stopped (didn't send anything after 500ms)
waiting on timer
- - after 80ms
-waited on timer at 160ms
- - after 240ms
+ - after 125ms
+waited on timer at 250ms
+ - after 250ms