Merge pull request #737 from aya-rs/more-kernels

github: run integration tests on local kernel
pull/821/head
Tamir Duberstein 1 year ago committed by GitHub
commit 8154fb79d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -246,7 +246,11 @@ jobs:
find test/.tmp -name '*.deb' -print0 | xargs -t -0 -I {} \
sh -c "dpkg --fsys-tarfile {} | tar -C test/.tmp --wildcards --extract '*vmlinuz*' --file -"
- name: Run integration tests
- name: Run local integration tests
if: runner.os == 'Linux'
run: cargo xtask integration-test local
- name: Run virtualized integration tests
run: find test/.tmp -name 'vmlinuz-*' | xargs -t cargo xtask integration-test vm
# Provides a single status check for the entire build workflow.

@ -1,4 +1,4 @@
use aya::{programs::UProbe, Bpf};
use aya::{programs::UProbe, util::KernelVersion, Bpf};
use test_log::test;
#[test]
@ -15,6 +15,12 @@ fn relocations() {
#[test]
fn text_64_64_reloc() {
let kernel_version = KernelVersion::current().unwrap();
if kernel_version < KernelVersion::new(5, 13, 0) {
eprintln!("skipping test on kernel {kernel_version:?}, support for bpf_for_each_map_elem was added in 5.13.0; see https://github.com/torvalds/linux/commit/69c087b");
return;
}
let mut bpf = load_and_attach("test_text_64_64_reloc", crate::TEXT_64_64_RELOC);
let mut m = aya::maps::Array::<_, u64>::try_from(bpf.map_mut("RESULTS").unwrap()).unwrap();

@ -9,14 +9,14 @@ use crate::utils::NetNsGuard;
#[test]
fn xdp() {
let _netns = NetNsGuard::new();
let kernel_version = KernelVersion::current().unwrap();
if kernel_version < KernelVersion::new(5, 18, 0) {
eprintln!("skipping test on kernel {kernel_version:?}, support for BPF_F_XDP_HAS_FRAGS was added in 5.18.0; see https://github.com/torvalds/linux/commit/c2f2cdb");
return;
}
let _netns = NetNsGuard::new();
let mut bpf = Bpf::load(crate::PASS).unwrap();
let dispatcher: &mut Xdp = bpf.program_mut("pass").unwrap().try_into().unwrap();
dispatcher.load().unwrap();
@ -47,13 +47,14 @@ fn two_progs() {
#[test]
fn extension() {
let _netns = NetNsGuard::new();
let kernel_version = KernelVersion::current().unwrap();
if kernel_version < KernelVersion::new(5, 9, 0) {
eprintln!("skipping test on kernel {kernel_version:?}, XDP uses netlink");
return;
}
let _netns = NetNsGuard::new();
let mut bpf = Bpf::load(crate::MAIN).unwrap();
let pass: &mut Xdp = bpf.program_mut("xdp_pass").unwrap().try_into().unwrap();
pass.load().unwrap();

Loading…
Cancel
Save