selftests/bpf: Replace EXPECT_EQ with ASSERT_EQ and refactor verify_results
authorAlexander Duyck <alexanderduyck@fb.com>
Tue, 3 Nov 2020 21:35:04 +0000 (13:35 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 4 Nov 2020 01:52:37 +0000 (17:52 -0800)
commitd3813ea14b696053c076123239093822b527f0f7
tree97fc51c0063ed458ae434635cb1bd75572e09e65
parent247f0ec361b7e0c5c67db8222873182fb8be5146
selftests/bpf: Replace EXPECT_EQ with ASSERT_EQ and refactor verify_results

There is already logic in test_progs.h for asserting that a value is
expected to be another value. So instead of reinventing it we should just
make use of ASSERT_EQ in tcpbpf_user.c. This will allow for better
debugging and integrates much more closely with the test_progs framework.

In addition we can refactor the code a bit to merge together the two
verify functions and tie them together into a single function. Doing this
helps to clean the code up a bit and makes it more readable as all the
verification is now done in one function.

Lastly we can relocate the verification to the end of the run_test since it
is logically part of the test itself. With this we can drop the need for a
return value from run_test since verification becomes the last step of the
call and then immediately following is the tear down of the test setup.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/160443930408.1086697.16101205859962113000.stgit@localhost.localdomain
tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c