eBPF-based security platform
ci: run the unit, functional and end-to-end tests as checks of their own
Daniel Borkmann9acb02a4a36b
diff --git a/.github/scripts/tests.sh b/.github/scripts/tests.shindex 1c366752..c3399954 100755--- a/.github/scripts/tests.sh+++ b/.github/scripts/tests.sh@@ -7,9 +7,10 @@# packages, a compatible LVH kernel or the Shirudo test kernel cache, and# the OpenSSL 3.5 toolchain from vm-toolchain.sh. run builds and runs the# unit, ci-checks, functional and end2end tests, each family of target tests-# in a VM of its own.+# in a VM of its own, or one part of them: unit runs the unit and+# ci-checks tests, functional and end2end the tier of that name.#-# .github/scripts/tests.sh setup|run+# .github/scripts/tests.sh setup|run [unit|functional|end2end]## Runs as a user with passwordless sudo, from the checkout.@@ -253,7 +254,17 @@ setup() {case "${1:-}" insetup|run) ;;*)- echo "usage: $0 setup|run" >&2+ echo "usage: $0 setup|run [unit|functional|end2end]" >&2+ exit 2+ ;;+esac++case "${2:-}" in+'') goals=tests ;;+unit) goals='-C testing unit ci-checks' ;;+functional|end2end) goals="-C testing $2" ;;+*)+ echo "usage: $0 setup|run [unit|functional|end2end]" >&2exit 2;;esac@@ -285,4 +296,5 @@ sudo prlimit --pid "$$" --memlock=unlimited:unlimited# sudo drops LD_LIBRARY_PATH even with -E and replaces PATH with its# secure_path, and the OpenSSL 3.5 build needs both: for the openssl the# config probes run and for every shirudo binary the tests run here.-sudo -E env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" make tests+# shellcheck disable=SC2086+sudo -E env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" make $goalsdiff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 82dd2e98..81ea6e81 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -17,10 +17,26 @@ concurrency:jobs:tests:- name: make tests+ name: ${{ matrix.name }}runs-on: ubuntu-latesttimeout-minutes: 150+ # One check per tier, so that a failure names its tier. They run one+ # after the other: on a cache miss the first builds the kernel and+ # the images and saves them for the next, and every tier runs even+ # when one before it failed.+ strategy:+ fail-fast: false+ max-parallel: 1+ matrix:+ include:+ - suite: unit+ name: unit tests+ - suite: functional+ name: functional tests+ - suite: end2end+ name: end-to-end tests+steps:- name: Check out repositoryuses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1@@ -55,8 +71,8 @@ jobs:- name: Prepare the runner as the VM hostrun: .github/scripts/tests.sh setup- - name: Run make tests- run: .github/scripts/tests.sh run+ - name: Run the ${{ matrix.name }}+ run: .github/scripts/tests.sh run ${{ matrix.suite }}# Each part is saved once it is complete, even when a later step# fails, so that the next run does not build it again.@@ -88,7 +104,7 @@ jobs:if: failure()uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2with:- name: guest-logs+ name: guest-logs-${{ matrix.suite }}path: |build/test-vm/vms/*/resultbuild/test-vm/vms/*/console.logdiff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstindex 66dd2b0f..a7f5bbf2 100644--- a/Documentation/contribute/code/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -442,8 +442,11 @@ the commit at ``HEAD`` alone without them.``shirudo-gen-runtime`` holds the target binary, and how muchspace it leaves. When it fails, raise ``size=`` in``tools/gen-image/shirudo-gen-runtime``.- * - ``tests.sh setup|run``- - Prepares a CI runner as the VM host and runs ``make tests``.+ * - ``tests.sh setup|run [unit|functional|end2end]``+ - Prepares a CI runner as the VM host and runs ``make tests``, or+ one part of it: ``unit`` runs the unit and ``ci-checks`` tests,+ ``functional`` and ``end2end`` the tier of that name. The ``CI+ suite`` workflow runs the three parts as checks of their own.Meant for CI runners, which are discarded afterwards.``check-style.sh`` fetches the kernel's ``checkpatch.pl`` at a pinned