From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202510 header.b=o1pY2l4M; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id D05D55A061B for ; Fri, 10 Oct 2025 05:45:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1760067950; bh=ROGb+TWZSxJJJNp0DxJ2X1prdfdA4oY8jtLCTdz21/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o1pY2l4M6voLg9XX98ePXnBKMLmCdJFjk0exmGtaMBV5rtSa1tPRH2r+mL7Q/oxWS 44m3rB2pZdEIqE+Tkf4oMfSOq8T8rN9McVxNxR/GLTHOThS/u7CXnt/7AW18m5bIAH z2TwNdXtpZfKXoP2+X7a5AFZXLGveEksgzKK3aQs5HpWBmGACersiq9UMaQAa5Dq49 pYZzIpdi7oplcEPGd2vjN9v/GdyY3RbYb2iidsShgPnPICi8efwlt3Pj1AygTzlxpO oWosTVgb49I2729IASO4kkSLyx1N9uRng/YTWvntDxqF6c5EQ+GASXB8UhCxGMTHm2 QKSHk5PDkE5CQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cjXhZ5k38z4wD0; Fri, 10 Oct 2025 14:45:50 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 3/3] test: For missing static checkers, skip rather than failing tests Date: Fri, 10 Oct 2025 14:45:49 +1100 Message-ID: <20251010034549.1821828-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251010034549.1821828-1-david@gibson.dropbear.id.au> References: <20251010034549.1821828-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: LXX7IDDRSLJL7G7YS5GOQ66BU635S7LT X-Message-ID-Hash: LXX7IDDRSLJL7G7YS5GOQ66BU635S7LT X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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 -. $(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