github.com/dylandreimerink/gobpfld@v0.6.1-0.20220205171531-e79c330ad608/cmd/testsuite/Readme.md (about) 1 # Test suite 2 3 This test suite attempts to test GoBPFLD, which consists of a few different kinds of tests: 4 - Integration tests - Execute a series of common BPF scenarios to see if we crash or get unexpected errors. This includes the loading of all sorts of programs and maps. We want a much coverage as possible. 5 - Compatibility tests - Execute the same tests on multiple architectures and kernel versions. GoBPFLD should be able to work on any architecture, and give proper warnings if features are not available on older kernels. 6 - Fuzzing - Call GoBPFLD with semi-random input in an attempt to break it. GoBPFLD should never panic in bad input, just return errors which users can handle. Focus areas are ELF parsing and decoding(including BTF, Program, and Map). 7 8 9 ## TODO / The plan 10 11 * Provide pre-compiled kernelBz + initrd images for a few kernel version (before and after notable BPF changes) via bpfci repo/project 12 * Provide pre-compiled kernelBz + initrd images for x86_64, i386, arm64 and RISC-V (maybe just the newest kernel versions for now) via bpfci repo/project 13 * Create `go test` compatible eBPF/XDP tests 14 * Create go program which automates environment setup and tests 15 * Pick which tests to run via the sub-commands 16 * Execute C/BPF recompilation(not needed if .o files are already committed) 17 * Execute go test/go build command for tests (add flag to only compile a specific test(for during debugging)) 18 * (cross) compile for x86_64, i386, arm64 and RISC-V if requested (command line flag) 19 * Compile with coverage if requested (command line flag) 20 * Compile with race condition checking if requested (command line flag) 21 * Compile with profiling options if requested (command line flags) 22 * Compile with JSON output (always, for automatic test checking) 23 * Run tests in QEMU for arch under test 24 * Make a mountable disk image on host (.qcow2 or raw) 25 * Place `run.sh` or `exec.sh` (known name called by bpfci `init` on load) in image 26 * script will execute generated test executable with requested cli arguments 27 * All outputs(exit code, stdout, stderr, coverage, profiles) are written to the mounted image 28 * After running tests, make the script poweroff the VM to indicate to the host we are done 29 * Place the unit test binary on the image 30 * Start VM which will start the tests once ready 31 * Mount or unpack the disk image and extract the test results 32 * Post process results 33 * Evaluate test results(json output) and display human readable errors. 34 * Generate HTML coverage reports(include raw data and HTML version) 35 * Generate SVGs of profiles 36 * Make .zip/.tar.gz of all results in run(may be multiple kernel versions / architectures) 37 * Display short and detailed test report (in markdown to be included in git) 38 * Run fuzzer (TODO research how to go about this)