You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aya/test
Dave Tucker 657fb44525 test: Add compile_c_ebpf to library
This allows for C code to be compiled and used in tests!
It does require libbpf on the host machine though...

Also moved removal of the `user` and `ebpf` dirs created by rust-script
into `lib.sh` and parameterized bits of the XDP smoke test for ease of
copying

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
..
cases test: Add compile_c_ebpf to library 3 years ago
.gitignore test: Add regression tests 3 years ago
README.md test: Add regression tests 3 years ago

README.md

Aya Regression Tests

The aya regression test suite is a set of tests to ensure that common usage behaviours work on real Linux distros

Prerequisites

This assumes you have a working Rust and Go toolchain on the host machine

  1. rustup toolcahin add x86_64-unknown-linux-musl
  2. Install rtf: go install github.com/linuxkit/rtf@latest
  3. Install rust-script: cargo install rust-script
  4. Install qemu and cloud-init-utils package - or any package that provides cloud-localds

It is not required, but the tests run significantly faster if you use sccache

Usage

To read more about how to use rtf, see the documentation

Run the tests with verbose output

rtf -vvv run

Run the tests using an older kernel

AYA_TEST_IMAGE=centos8 rtf -vvv run

Writing a test

Tests should follow this pattern:

  • The eBPF code should be in a file named ${NAME}.ebpf.rs
  • The userspace code should be in a file named ${NAME}.rs
  • The userspace program should make assertions and exit with a non-zero return code to signal failure
  • VM start and stop is handled by the framework
  • Any files copied to the VM should be cleaned up afterwards

See ./cases for examples