Debian Codegraph @

ebpf_test.go

raw symbols SCIP
1 package cbpfc
2
3 import (
4 "testing"
5
6 "github.com/cilium/ebpf"
7 "golang.org/x/net/bpf"
8 )
9
10 // ebpfBacked is backend that compiles classic BPF to eBPF
11 func ebpfBackend(tb testing.TB, insns []bpf.Instruction, in []byte, opts backendOpts) result {
12 prog, err := buildEBPF(insns, opts.offset)
13 if err != nil {
14 tb.Fatal(err)
15 }
16
17 tb.Logf("\n%v", prog)
18
19 return testProg(tb, &ebpf.ProgramSpec{
20 Name: "ebpf_filter",
21 Type: ebpf.XDP,
22 Instructions: prog,
23 License: "BSD",
24 }, in)
25 }