Move kernel version check inwards

The run_selftests.sh script defines functions for running individual
tests. However, not all tests are run in all configurations. E.g.,
test_progs is not run on 4.9.0 kernels and test_maps is only run when
testing on the "latest" kernel version. The checks for these conditions,
however, are applied inconsistently: some are in the functions
themselves and others on the call site.
This change unifies all checks to happen within the test function
itself.

Signed-off-by: Daniel Müller <deso@posteo.net>
This commit is contained in:
Daniel Müller
2022-08-15 15:24:41 -07:00
committed by danielocfb
parent 66b788c1a4
commit c03b9f6d0b

View File

@@ -36,17 +36,21 @@ test_progs_noalu() {
}
test_maps() {
foldable start test_maps "Testing test_maps"
./test_maps && true
echo "test_maps:$?" >> "${STATUS_FILE}"
foldable end test_maps
if [[ "${KERNEL}" == 'latest' ]]; then
foldable start test_maps "Testing test_maps"
./test_maps && true
echo "test_maps:$?" >> "${STATUS_FILE}"
foldable end test_maps
fi
}
test_verifier() {
foldable start test_verifier "Testing test_verifier"
./test_verifier && true
echo "test_verifier:$?" >> "${STATUS_FILE}"
foldable end test_verifier
if [[ "${KERNEL}" == 'latest' ]]; then
foldable start test_verifier "Testing test_verifier"
./test_verifier && true
echo "test_verifier:$?" >> "${STATUS_FILE}"
foldable end test_verifier
fi
}
foldable end vm_init
@@ -59,8 +63,5 @@ cd ${PROJECT_NAME}/selftests/bpf
test_progs
test_progs_noalu
if [[ "${KERNEL}" == 'latest' ]]; then
test_maps
test_verifier
fi
test_maps
test_verifier