Skip to content

Commit 7387cd3

Browse files
committed
test: Ensure that BTF type information is available
BTF types are required for CO-RE eBPF programs. Check if the kernel was compiled with CONFIG_DEBUG_INFO_BTF and created the /sys/kernel/btf/vmlinux file.
1 parent 987f175 commit 7387cd3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/integration/iso_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"fmt"
2424
"os/exec"
2525
"runtime"
26+
"strings"
2627
"testing"
2728

2829
"k8s.io/minikube/pkg/minikube/vmpath"
@@ -99,4 +100,17 @@ func TestISOImage(t *testing.T) {
99100
})
100101
}
101102
})
103+
104+
t.Run("eBPFSupport", func(t *testing.T) {
105+
// Ensure that BTF type information is available (https://github.com/kubernetes/minikube/issues/21788)
106+
btfFile := "/sys/kernel/btf/vmlinux"
107+
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", fmt.Sprintf("test -f %s && echo 'OK' || echo 'NOT FOUND'", btfFile)))
108+
if err != nil {
109+
t.Errorf("failed to verify existence of %q file: args %q: %v", btfFile, rr.Command(), err)
110+
}
111+
112+
if !strings.Contains(rr.Stdout.String(), "OK") {
113+
t.Errorf("expected file %q to exist, but it does not. BTF types are required for CO-RE eBPF programs; set CONFIG_DEBUG_INFO_BTF in kernel configuration.", btfFile)
114+
}
115+
})
102116
}

0 commit comments

Comments
 (0)