Run eBPF Tests with Little VM Helper
Prerequisites
Install
qemu-utils:$ sudo apt-get install qemu-utils
Build Little VM Helper CLI
Checkout the LVH repo:
$ gh repo clone cilium/little-vm-helper
Build the CLI:
$ make little-vm-helper
VM image selection and preparation
You can find all available image types here. In this tutorial we use the
complexity-testimage.Pull the image:
$ ./lvh images pull quay.io/lvh-images/complexity-test:bpf-net-main --dir /var/tmp/
Resize the image (optional):
$ qemu-img resize /var/tmp/images/complexity-test_bpf-net.qcow2 +16G
VM preparation
Run the VM:
$ ./lvh run --image /var/tmp/images/complexity-test_bpf-net.qcow2 \ --host-mount <path-to-cilium-repo> \ --cpu-kind=host \ --cpu=2 \ --mem=8G \ -p 2222:22 \ --console-log-file=/tmp/lvh-console.log
SSH to the VM:
$ ssh -p 2222 root@localhost $ resize2fs /dev/vda $ git config --global --add safe.directory /host $ apt update && apt install -y -o Dpkg::Options::="--force-confold" xxd docker-buildx-plugin
Run tests
All tests:
$ cd /host $ make run_bpf_tests
Specific test:
$ cd /host $ make run_bpf_tests BPF_TEST="xdp_nodeport_lb4_nat_lb"
Verbose mode:
$ cd /host $ make run_bpf_tests BPF_TEST_VERBOSE=1
Dump context:
$ cd /host $ make run_bpf_tests BPF_TEST_DUMP_CTX=1 BPF_TEST_VERBOSE=1