Skip to content

eBPF-based security platform

ci: skip duplicate full-tree checks when Lint runs

Andrea Lattuada76630fb8f949
diff --git a/.github/scripts/tests.sh b/.github/scripts/tests.sh
index 6ebd3073..5735b96d 100755
--- a/.github/scripts/tests.sh
+++ b/.github/scripts/tests.sh
@@ -159,4 +159,5 @@ sudo prlimit --pid "$$" --memlock=unlimited:unlimited
# config probes run and for every shirudo binary the tests run here.
# shellcheck disable=SC2086
sudo -E env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
- COVERAGE="${COVERAGE:-0}" make VM="${VM:-1}" $goals
+ COVERAGE="${COVERAGE:-0}" SHIRUDO_SKIP_TREE_CHECKS="${SHIRUDO_SKIP_TREE_CHECKS:-0}" \
+ make VM="${VM:-1}" $goals
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index c79664d4..b6751e35 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -82,6 +82,8 @@ jobs:
# reports the failure: every tier runs and the report is sent.
- name: Run unit tests
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
+ env:
+ SHIRUDO_SKIP_TREE_CHECKS: ${{ github.event_name == 'push' && '1' || '0' }}
run: .github/scripts/tests.sh run unit
- name: Run functional tests
diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml
index 1c67371f..62f9dade 100644
--- a/.github/workflows/sanitizers.yml
+++ b/.github/workflows/sanitizers.yml
@@ -37,6 +37,10 @@ jobs:
- name: TSan
sanitize: thread
compiler: clang
+ env:
+ SHIRUDO_SKIP_TREE_CHECKS: >-
+ ${{ (github.event_name == 'pull_request' ||
+ (github.event_name == 'push' && github.ref == 'refs/heads/main')) && '1' || '0' }}
steps:
- name: Check out repository
@@ -89,7 +93,8 @@ jobs:
make -j4 SANITIZE=${{ matrix.sanitize }}
make SANITIZE=${{ matrix.sanitize }} shirudo-build
make -C testing SANITIZE=${{ matrix.sanitize }} test-helpers
- make tests VM=0 BACKEND=0 SANITIZE=${{ matrix.sanitize }}
+ SHIRUDO_SKIP_TREE_CHECKS=${{ env.SHIRUDO_SKIP_TREE_CHECKS }} \
+ make tests VM=0 BACKEND=0 SANITIZE=${{ matrix.sanitize }}
- name: Save the sanitizer OpenSSL build
if: always() && steps.sanitizer-openssl.outputs.cache-hit != 'true' && hashFiles('build/sanitizer-openssl/lib/libcrypto.so') != ''
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index fe05cda0..c0e40a54 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -150,6 +150,10 @@ jobs:
- name: Run unit tests
if: matrix.suite == 'unit' || matrix.suite == 'host'
+ env:
+ SHIRUDO_SKIP_TREE_CHECKS: >-
+ ${{ (github.event_name == 'pull_request' ||
+ (github.event_name == 'push' && github.ref == 'refs/heads/main')) && '1' || '0' }}
run: .github/scripts/tests.sh run unit
- name: Run host functional tests
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index 09878fc5..7dfbe728 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -58,6 +58,11 @@ The functional shards run upatch, tamperproof, the BPM families, and
the remaining families. The arm64 host job runs unit, script, and host
functional tests together.
+On pull requests and pushes to ``main``, Lint runs the full-tree Coccinelle
+and unused-function checks. The CI suite, coverage, and sanitizer jobs still
+run the self-tests for both scripts. Local, manually dispatched, and sanitizer
+tag runs also scan the full tree as part of ``ci-checks``.
+
The ``CI suite`` workflow uses the x86-64 CI kernel package.
:src:`testing/vm/kernel-artifact.sh` pins its build run ID and checksums.
When a change touches the kernel build inputs, CI builds packages for
diff --git a/testing/ci-checks/t0006-check-coccinelle.sh b/testing/ci-checks/t0006-check-coccinelle.sh
index 0a746ac8..e0626b8b 100755
--- a/testing/ci-checks/t0006-check-coccinelle.sh
+++ b/testing/ci-checks/t0006-check-coccinelle.sh
@@ -1714,9 +1714,11 @@ test_expect_success 'every rule declares SEC an attribute' '
done
'
-test_expect_success 'the tree passes' '
- (cd "$ROOT" && sh "$S") >"$W/out" 2>"$W/err" &&
- grep -q "rules, no match" "$W/out"
-'
+if [ "${SHIRUDO_SKIP_TREE_CHECKS:-0}" != 1 ]; then
+ test_expect_success 'the tree passes' '
+ (cd "$ROOT" && sh "$S") >"$W/out" 2>"$W/err" &&
+ grep -q "rules, no match" "$W/out"
+ '
+fi
test_done
diff --git a/testing/ci-checks/t0009-check-unused.sh b/testing/ci-checks/t0009-check-unused.sh
index 521f69ca..ab89afa7 100755
--- a/testing/ci-checks/t0009-check-unused.sh
+++ b/testing/ci-checks/t0009-check-unused.sh
@@ -84,8 +84,10 @@ test_expect_success 'a prototype in a C file is no definition' '
check
'
-test_expect_success 'the tree itself passes' '
- sh "$S"
-'
+if [ "${SHIRUDO_SKIP_TREE_CHECKS:-0}" != 1 ]; then
+ test_expect_success 'the tree itself passes' '
+ sh "$S"
+ '
+fi
test_done