On Mon, 2024-03-04 at 13:46 +0000, Haojian Zhuang wrote: [...] > Sure. My test case is in the link (https://github.com/hzhuang1/linux/blob/bpf02/tools/testing/selftests/bpf/progs/test_crypto_kern.c). Strange, I've tried your branch w/o suggested verifier change and program loaded w/o error. I'll wait for a smaller selftest. > > I have an old writeup on setting up local testing environment, > > if you need it I can update and share it. > > It's better if you can share it. Well, looking at your branch I don't think you really need it, I assume that you already have elaborated setup, so this could only serve to establish some kind of baseline for tests execution. Anyways at [0] is a small recipe on how to setup local build environment capable to build and run selftests in chroot assuming certain directory structure. All heavy-lifting is done by the script vmtest.sh already in the repo: - it makes sure kernel is compiled with correct config; - compiles selftests; - downloads qemu rootfs for VM; - starts VM and executes tests. Some info about 'test_progs' binary: - this binary is a driver for multiple test groups execution; - each test group is split in two parts: - BPF programs used by group are defined under progs/ - userspace part that drives the testing and sets up the BPF programs is defined in C files under prog_tests/ - Makefile for selftests scans all C files under prog_tests/ looking for functions defined as "void test_<something>(void)" and assumes that these are entry points for test groups; - Makefile organizes an array of pointers to functions, defined in test_progs.c, same file contains the main logic that initiates tests execution for each test case. [0] https://gist.github.com/eddyz87/204a47145452f1fc4792c8a55be53d6d