|
5 | 5 |
|
6 | 6 | // This doesn't need BPF, but it's built with this tag to only run with |
7 | 7 | // system-probe tests. |
8 | | -//go:build test && linux_bpf && !dd_discovery_cgo |
| 8 | +//go:build test && linux_bpf && !dd_discovery_rust |
9 | 9 |
|
10 | 10 | package module |
11 | 11 |
|
@@ -309,7 +309,6 @@ func newDiscovery() *discovery { |
309 | 309 | return mod.(*discovery) |
310 | 310 | } |
311 | 311 |
|
312 | | - |
313 | 312 | // addSockets adds only listening sockets to a map to be used for later looksups. |
314 | 313 | func addSockets[P procfs.NetTCP | procfs.NetUDP](sockMap map[uint64]socketInfo, sockets P, |
315 | 314 | family network.ConnectionFamily, ctype network.ConnectionType, state uint64, |
@@ -402,6 +401,21 @@ func BenchmarkGetNSInfoOld(b *testing.B) { |
402 | 401 | } |
403 | 402 | } |
404 | 403 |
|
| 404 | +func createTracerMemfd(t *testing.T, data []byte) int { |
| 405 | + t.Helper() |
| 406 | + fd, err := unix.MemfdCreate("datadog-tracer-info-xxx", 0) |
| 407 | + require.NoError(t, err) |
| 408 | + t.Cleanup(func() { unix.Close(fd) }) |
| 409 | + err = unix.Ftruncate(fd, int64(len(data))) |
| 410 | + require.NoError(t, err) |
| 411 | + mappedData, err := unix.Mmap(fd, 0, len(data), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED) |
| 412 | + require.NoError(t, err) |
| 413 | + copy(mappedData, data) |
| 414 | + err = unix.Munmap(mappedData) |
| 415 | + require.NoError(t, err) |
| 416 | + return fd |
| 417 | +} |
| 418 | + |
405 | 419 | func TestValidInvalidTracerMetadata(t *testing.T) { |
406 | 420 | discovery := newDiscovery() |
407 | 421 | require.NotEmpty(t, discovery) |
|
0 commit comments