retina icon indicating copy to clipboard operation
retina copied to clipboard

[test] unit testing for bpf programs

Open nddq opened this issue 1 year ago • 4 comments

Would be great if we have those

nddq avatar Oct 18 '24 22:10 nddq

@nddq @ibezrukavyi @ritwikranjan I'd like to give this a try. Feel free to assign it to me if it's still open for contributors.

VigneshSP94 avatar May 28 '25 19:05 VigneshSP94

Hey @VigneshSP94 Please let us know what you plan on doing

ritwikranjan avatar May 28 '25 19:05 ritwikranjan

@ritwikranjan Currently, by observing dropreason_linux_test.go as example -

1 - It tests compiling the dropreason.c to an object file and see if the object file exists. 2 - It tests the processing of the Map that it gets from the ebpf program. so on.. so forth

I'm thinking that, the current test framework could be extended to directly test bpf program behaviour using the cilium/ebpf Test() functionality and create tests that verify the actual behavior of bpf programs with simulated inputs.

Starting with the dropreason plugin's bpf programs and expanding to others. I can start with this if OK.

VigneshSP94 avatar May 29 '25 14:05 VigneshSP94

The idea sounds good to me

ritwikranjan avatar May 29 '25 15:05 ritwikranjan