mirror of
https://github.com/vishvananda/netlink
synced 2025-01-01 12:32:03 +00:00
Skip test if bpf syscall is unavailable
This commit is contained in:
parent
17b1e35dbc
commit
719d8ca65a
@ -3,10 +3,12 @@ package netlink
|
||||
/*
|
||||
#include <asm/types.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int load_simple_bpf(int prog_type) {
|
||||
#ifdef __NR_bpf
|
||||
// { return 1; }
|
||||
__u64 __attribute__((aligned(8))) insns[] = {
|
||||
0x00000001000000b7ull,
|
||||
@ -32,6 +34,10 @@ static int load_simple_bpf(int prog_type) {
|
||||
.license = (__u64)&license,
|
||||
};
|
||||
return syscall(__NR_bpf, 5, &attr, sizeof(attr));
|
||||
#else
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
@ -294,7 +294,7 @@ func TestFilterU32BpfAddDel(t *testing.T) {
|
||||
|
||||
fd, err := loadSimpleBpf(BPF_PROG_TYPE_SCHED_ACT)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Skipf("Loading bpf program failed: %s", err)
|
||||
}
|
||||
filter := &U32{
|
||||
FilterAttrs: FilterAttrs{
|
||||
@ -415,7 +415,7 @@ func TestFilterClsActBpfAddDel(t *testing.T) {
|
||||
}
|
||||
fd, err := loadSimpleBpf(BPF_PROG_TYPE_SCHED_CLS)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Skipf("Loading bpf program failed: %s", err)
|
||||
}
|
||||
filter := &BpfFilter{
|
||||
FilterAttrs: filterattrs,
|
||||
|
Loading…
Reference in New Issue
Block a user