MCPcopy Index your code
hub / github.com/cilium/ebpf / TestCacheConcurrentModule

Function TestCacheConcurrentModule

btf/kernel_test.go:110–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestCacheConcurrentModule(t *testing.T) {
111 if _, err := os.Stat("/sys/kernel/btf/bpf_testmod"); os.IsNotExist(err) {
112 t.Skip("/sys/kernel/btf/bpf_testmod not present")
113 }
114
115 const goroutines = 8
116
117 c := NewCache()
118 specs := make([]*Spec, goroutines)
119 errs := make([]error, goroutines)
120
121 var wg sync.WaitGroup
122 wg.Add(goroutines)
123 for i := range goroutines {
124 go func(i int) {
125 defer wg.Done()
126 specs[i], errs[i] = c.Module("bpf_testmod")
127 }(i)
128 }
129 wg.Wait()
130
131 for _, err := range errs {
132 qt.Assert(t, qt.IsNil(err))
133 }
134 for i := 1; i < goroutines; i++ {
135 qt.Assert(t, qt.Equals(specs[0], specs[i]))
136 }
137}

Callers

nothing calls this directly

Calls 5

ModuleMethod · 0.95
NewCacheFunction · 0.85
IsNilMethod · 0.80
WaitMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…