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