tests: skip tests that assume bpf_link based XDP on older kernels

pull/439/merge
Alessandro Decina 2 years ago
parent 66d435fc7c
commit 9ce1530695

@ -9,6 +9,9 @@ use aya::{
}, },
Bpf, Bpf,
}; };
use log::warn;
use crate::tests::kernel_version;
use super::{integration_test, IntegrationTest}; use super::{integration_test, IntegrationTest};
@ -107,6 +110,11 @@ fn unload() {
#[integration_test] #[integration_test]
fn pin_link() { fn pin_link() {
if kernel_version().unwrap() < (5, 9, 0) {
warn!("skipping test, XDP uses netlink");
return;
}
let bytes = include_bytes_aligned!("../../../../target/bpfel-unknown-none/debug/test"); let bytes = include_bytes_aligned!("../../../../target/bpfel-unknown-none/debug/test");
let mut bpf = Bpf::load(bytes).unwrap(); let mut bpf = Bpf::load(bytes).unwrap();
let prog: &mut Xdp = bpf.program_mut("test_unload").unwrap().try_into().unwrap(); let prog: &mut Xdp = bpf.program_mut("test_unload").unwrap().try_into().unwrap();
@ -133,6 +141,11 @@ fn pin_link() {
#[integration_test] #[integration_test]
fn pin_lifecycle() { fn pin_lifecycle() {
if kernel_version().unwrap() < (5, 9, 0) {
warn!("skipping test, XDP uses netlink");
return;
}
let bytes = include_bytes_aligned!("../../../../target/bpfel-unknown-none/debug/pass"); let bytes = include_bytes_aligned!("../../../../target/bpfel-unknown-none/debug/pass");
// 1. Load Program and Pin // 1. Load Program and Pin

Loading…
Cancel
Save