On Wed, 10 Apr 2019 20:50:25 +0100, Jiong Wang wrote: > Enable BPF_F_TEST_RND_HI32 for all existing bpf selftests or other > independent tests could involve quite a few changes to make sure all bpf > prog load places has BPF_F_TEST_RND_HI32 set. > > Given most of the tests are using libbpf, this patch introduces a new > global variable "libbpf_test_mode" into libbpf, once which is set, all bpf > prog load issued through libbpf will have BPF_F_TEST_RND_HI32 set > automatically, this could minimize changes required from testsuite. > > The other way might be introducing new load function like > "bpf_prog_test_load", which will set BPF_F_TEST_RND_HI32. But there are > several prog load APIs, and we need minor changes on some parameters. > > The global variable approach seems to be a proper first step for easy > testsuite porting. > > Signed-off-by: Jiong Wang <jiong.wang@xxxxxxxxxxxxx> Can we perhaps make it per-object by setting it after bpf_object__open() but before bpf_object__load(), or add it to struct bpf_object_open_attr?