(t *testing.T)
| 121 | } |
| 122 | |
| 123 | func TestKprobeMultiProgramCall(t *testing.T) { |
| 124 | testutils.SkipIfNotSupported(t, features.HaveBPFLinkKprobeMulti()) |
| 125 | |
| 126 | m, p := newUpdaterMapProg(t, ebpf.Kprobe, ebpf.AttachTraceKprobeMulti) |
| 127 | |
| 128 | // Use actual syscall names with platform prefix. |
| 129 | // For simplicity, just assert the increment happens with any symbol in the array. |
| 130 | prefix := linux.PlatformPrefix() |
| 131 | opts := KprobeMultiOptions{ |
| 132 | Symbols: []string{prefix + "sys_getpid", prefix + "sys_gettid"}, |
| 133 | } |
| 134 | km, err := KprobeMulti(p, opts) |
| 135 | if err != nil { |
| 136 | t.Fatal(err) |
| 137 | } |
| 138 | |
| 139 | // Trigger ebpf program call. |
| 140 | unix.Getpid() |
| 141 | unix.Gettid() |
| 142 | |
| 143 | // Assert that the value got incremented to at least 2, while allowing |
| 144 | // for bigger values, because we could race with other getpid/gettid |
| 145 | // callers. |
| 146 | assertMapValueGE(t, m, 0, 2) |
| 147 | |
| 148 | // Close the link. |
| 149 | if err := km.Close(); err != nil { |
| 150 | t.Fatal(err) |
| 151 | } |
| 152 | |
| 153 | // Reset map value to 0 at index 0. |
| 154 | if err := m.Update(uint32(0), uint32(0), ebpf.UpdateExist); err != nil { |
| 155 | t.Fatal(err) |
| 156 | } |
| 157 | |
| 158 | // Retrigger the ebpf program call. |
| 159 | unix.Getpid() |
| 160 | unix.Gettid() |
| 161 | |
| 162 | // Assert that this time the value has not been updated. |
| 163 | assertMapValue(t, m, 0, 0) |
| 164 | } |
| 165 | |
| 166 | func TestKprobeSession(t *testing.T) { |
| 167 | testutils.SkipIfNotSupported(t, features.HaveBPFLinkKprobeSession()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…