mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
test: make tests deterministic with -scheduler=threads
This commit is contained in:
committed by
Ron Evans
parent
6faf36fc64
commit
31f7214156
Vendored
+6
-2
@@ -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{}) {
|
||||
|
||||
Reference in New Issue
Block a user