-
Notifications
You must be signed in to change notification settings - Fork 6
selftests/bpf: Integrate test_xsk.c to test_progs framework #5888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
selftests/bpf: Integrate test_xsk.c to test_progs framework #5888
Conversation
Upstream branch: c9110e6 |
0e26bd3
to
4e70ac0
Compare
Upstream branch: abc8a95 |
904de01
to
89e35cb
Compare
4e70ac0
to
c04dd5a
Compare
Upstream branch: 929adf8 |
89e35cb
to
f016476
Compare
c04dd5a
to
4754b79
Compare
Upstream branch: 2d92ef7 |
f016476
to
c34ae28
Compare
4754b79
to
af15c58
Compare
Upstream branch: b338cf8 |
c34ae28
to
99b6d1d
Compare
af15c58
to
c979e9f
Compare
Upstream branch: 9621eb6 |
99b6d1d
to
a0dbb97
Compare
c979e9f
to
2d215b0
Compare
Upstream branch: e12873e |
a0dbb97
to
33cb2b7
Compare
2d215b0
to
05282f4
Compare
0f635c7
to
cde4d9b
Compare
Upstream branch: 3ae4c52 |
ef8e7e5
to
5b97ecc
Compare
cde4d9b
to
2b3c471
Compare
Upstream branch: b13448d |
5b97ecc
to
cc085b9
Compare
2b3c471
to
2211108
Compare
AF_XDP features are tested by the test_xsk.sh script but not by the test_progs framework. The tests used by the script are defined in xksxceiver.c which can't be integrated in the test_progs framework as is. Extract these test definitions from xskxceiver{.c/.h} to put them in new test_xsk{.c/.h} files. Keep the main() function and its unshared dependencies in xksxceiver to avoid impacting the test_xsk.sh script which is often used to test real hardware. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
bitmap is used before being initialized. Initialize it to zero before using it. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Some tests introduce memory leaks by not freeing all the pkt_stream objects they're creating. Fix these memory leaks. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
The clean-up done at the end of a test in __testapp_validate_traffic() isn't wrapped in a function. It isn't convenient if we want to use it somewhere else in the code. Wrap the clean-up in two new functions : the first deletes the sockets, the second releases the umem. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
testapp_validate_traffic() doesn't release the sockets and the umem created by the threads if the test isn't currently in its last step. Thus, if the swap_xsk_resources() fails before the last step, the created resources aren't cleaned up. Clean the sockets and the umem in case of swap_xsk_resources() failure. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
init_iface() doesn't have any return value while it can fail. In case of failure it calls exit_on_error() which exits the application immediately. This prevents the following tests from being run and isn't compliant with the CI Add a return value to init_iface() so errors can be handled more smoothly. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
xsk_reattach_xdp calls exit_with_error() on failures. This exits the program immediately. It prevents the following tests from being run and isn't compliant with the CI. Add a return value to the functions handling XDP attachments to handle errors more smoothly. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
exit_with_error() is called when gettimeofday() fails. This exits the program immediately. It prevents the following tests from being run and isn't compliant with the CI. Return TEST_FAILURE instead of calling exit_on_error(). Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
TX and RX workers can fail in many places. These failures trigger a call to exit_with_error() which exits the program immediately. It prevents the following tests from running and isn't compliant with the CI. Add return value to functions that can fail. Handle failures more smoothly through report_failure(). Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
…ails __testapp_validate_traffic() calls exit_with_error() on failures. This exits the program immediately. It prevents the following tests from running and isn't compliant with the CI. Return TEST_FAILURE instead of calling exit_with_error(). Release the resource of the 1st thread if a failure happens between its creation and the creation of the second thread. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
If any allocation in the pkt_stream_*() helpers fail, exit_with_error() is called. This terminates the program immediately. It prevents the following tests from running and isn't compliant with the CI. Return NULL in case of allocation failure. Return TEST_FAILURE when something goes wrong in the packet generation. Clean up the resources if a failure happens between two steps of a test. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
exit_with_error() isn't called by test_xsk.c. It shouldn't be called in the future either, since some resources need to be cleaned before exiting when an error occurs. Move the definition of exit_with_error() to xskxceiver.c, where it's still used. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Upstream branch: 180a46b |
Some tests are flaky and fail from time to time on virtual interfaces. Adding them to the CI would trigger lots of 'false' errors. Remove the flaky tests from the nominal tests table so they won't be run by the CI in upcoming patch. Create a flaky_tests table to hold them. Use this flaky table in xskxceiver.c to keep all the tests available from the test_xsk.sh script. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
test_xsk.c isn't part of the test_progs framework. Integrate the tests defined by test_xsk.c into the test_progs framework through a new file : prog_tests/xsk.c. ZeroCopy mode isn't tested in it as veth peers don't support it. Move test_xsk{.c/.h} to prog_tests/. Add the find_bit library to test_progs sources in the Makefile as it is is used by test_xsk.c Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
cc085b9
to
b4d262f
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=998798 expired. Closing PR. |
Pull request for series with
subject: selftests/bpf: Integrate test_xsk.c to test_progs framework
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=998798