...
1 package features
2
3 import (
4 "testing"
5
6 "github.com/cilium/ebpf/internal/testutils"
7 )
8
9 func TestHaveMisc(t *testing.T) {
10 tests := map[string]struct {
11 typ miscType
12 probe func() error
13 minKernel string
14 }{
15 "large instructions": {typ: largeInsn, probe: HaveLargeInstructions, minKernel: "5.2"},
16 "bounded loops": {typ: boundedLoops, probe: HaveBoundedLoops, minKernel: "5.3"},
17 "v2 ISA": {typ: v2ISA, probe: HaveV2ISA, minKernel: "4.14"},
18 "v3 ISA": {typ: v3ISA, probe: HaveV3ISA, minKernel: "5.1"},
19 }
20
21 for misc, test := range tests {
22 test := test
23 t.Run(misc, func(t *testing.T) {
24 testutils.SkipOnOldKernel(t, test.minKernel, misc)
25
26 if err := test.probe(); err != nil {
27 t.Fatalf("Feature %s isn't supported even though kernel is at least %s: %v",
28 misc, test.minKernel, err)
29 }
30 })
31 }
32 }
33
View as plain text