Source file
src/runtime/nosan_linux_test.go
1
2
3
4
5
6
7
8
9 package runtime_test
10
11 import (
12 "internal/abi"
13 "runtime"
14 "testing"
15 "time"
16 "unsafe"
17 )
18
19 var newOSProcDone bool
20
21
22 func newOSProcCreated() {
23 newOSProcDone = true
24 }
25
26
27
28 func TestNewOSProc0(t *testing.T) {
29 runtime.NewOSProc0(0x800000, unsafe.Pointer(abi.FuncPCABIInternal(newOSProcCreated)))
30 check := time.NewTicker(100 * time.Millisecond)
31 defer check.Stop()
32 end := time.After(5 * time.Second)
33 for {
34 select {
35 case <-check.C:
36 if newOSProcDone {
37 return
38 }
39 case <-end:
40 t.Fatalf("couldn't create new OS process")
41 }
42 }
43 }
44
View as plain text