From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 3/3] test: For missing static checkers, skip rather than failing tests
Date: Fri, 10 Oct 2025 14:45:49 +1100 [thread overview]
Message-ID: <20251010034549.1821828-4-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20251010034549.1821828-1-david@gibson.dropbear.id.au>
We run a bunch of static checkers as part of our testsuite. That's useful,
but it means that if a user doesn't have one of them installed, it fails
the entire testsuite. Alter our scripts to skip the test, rather than
failing outright if the checker tool is not installed.
This requires exeter v0.4.4 or later.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
test/build/static_checkers.sh | 24 ++++++++++++++++++------
test/lib/exeter | 10 +++++++++-
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/test/build/static_checkers.sh b/test/build/static_checkers.sh
index 228b99ae..96679fb2 100755
--- a/test/build/static_checkers.sh
+++ b/test/build/static_checkers.sh
@@ -13,18 +13,30 @@
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>
-. $(dirname $0)/../exeter/sh/exeter.sh
+. $(dirname ${0})/../exeter/sh/exeter.sh
-exeter_register cppcheck make -C .. cppcheck
+# do_check() - Run static checker as a test if the binary is available
+# $1: Static checker (uased as both executable name and make target)
+# $@: Any additional arguments required to make
+do_check() {
+ checker="${1}"
+ shift
+ if ! which "${checker}" >/dev/null 2>/dev/null; then
+ exeter_skip "${checker} not available"
+ fi
+ make "${@}" "${checker}"
+}
+
+exeter_register cppcheck do_check cppcheck -C ..
exeter_set_description cppcheck "passt sources pass cppcheck"
-exeter_register clang_tidy make -C .. clang-tidy
+exeter_register clang_tidy do_check clang-tidy -C ..
exeter_set_description clang_tidy "passt sources pass clang-tidy"
-exeter_register flake8 make flake8
+exeter_register flake8 do_check flake8
exeter_set_description flake8 "passt tests in Python pass flake8"
-exeter_register mypy make mypy
+exeter_register mypy do_check mypy
exeter_set_description mypy "passt tests in Python pass mypy --strict"
-exeter_main "$@"
+exeter_main "${@}"
diff --git a/test/lib/exeter b/test/lib/exeter
index 7ea084a4..ccdb19c2 100644
--- a/test/lib/exeter
+++ b/test/lib/exeter
@@ -49,7 +49,15 @@ exeter() {
for __testid in $(${EXETOOL} list -- "${@}"); do
__desc="$(${EXETOOL} desc -- "${@}" -- "${__testid}")"
status_test_start "${__desc}"
- context_run host "${*} '${__testid}'" && status_test_ok || status_test_fail
+ status=0
+ context_run host "${*} '${__testid}'" || status="${?}"
+ if [ "${status}" = 0 ]; then
+ status_test_ok
+ elif [ "${status}" = 77 ]; then
+ status_test_skip
+ else
+ status_test_fail
+ fi
done
cd ..
--
2.51.0
prev parent reply other threads:[~2025-10-10 3:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-10 3:45 [PATCH v2 0/3] Fixes to exeter test integration David Gibson
2025-10-10 3:45 ` [PATCH v2 1/3] test: Use ${} consistently in lib/exeter David Gibson
2025-10-10 3:45 ` [PATCH v2 2/3] test: Add some missing quoting in exeter runner David Gibson
2025-10-10 3:45 ` David Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251010034549.1821828-4-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).