From c03b9f6d0b3eff8b480613bba79f4792ed080f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Mon, 15 Aug 2022 15:24:41 -0700 Subject: [PATCH] Move kernel version check inwards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- travis-ci/vmtest/run_selftests.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/travis-ci/vmtest/run_selftests.sh b/travis-ci/vmtest/run_selftests.sh index 30aec6e..324ef31 100755 --- a/travis-ci/vmtest/run_selftests.sh +++ b/travis-ci/vmtest/run_selftests.sh @@ -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