aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/recover.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-11-04 10:16:35 +0100
committerRon Evans <[email protected]>2024-12-06 11:55:34 +0100
commit31f72141561dafe3f0323599ca0307b34c3fc1da (patch)
treeebb50bdb3113581f995d075f02dd9eab1306efc0 /testdata/recover.go
parent6faf36fc6420809d442aa7d0efdb5e3b524d0289 (diff)
downloadtinygo-31f72141561dafe3f0323599ca0307b34c3fc1da.tar.gz
tinygo-31f72141561dafe3f0323599ca0307b34c3fc1da.zip
test: make tests deterministic with -scheduler=threads
Diffstat (limited to 'testdata/recover.go')
-rw-r--r--testdata/recover.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/testdata/recover.go b/testdata/recover.go
index 260bf91bd..6fdf282e7 100644
--- a/testdata/recover.go
+++ b/testdata/recover.go
@@ -2,9 +2,11 @@ package main
import (
"runtime"
- "time"
+ "sync"
)
+var wg sync.WaitGroup
+
func main() {
println("# simple recover")
recoverSimple()
@@ -113,14 +115,16 @@ func deferPanic() {
}
func runtimeGoexit() {
+ wg.Add(1)
go func() {
defer func() {
println("Goexit deferred function, recover is nil:", recover() == nil)
+ wg.Done()
}()
runtime.Goexit()
}()
- time.Sleep(time.Millisecond)
+ wg.Wait()
}
func printitf(msg string, itf interface{}) {