From: sashiko-bot@kernel.org
To: "Oleksij Rempel" <o.rempel@pengutronix.de>
Cc: linux-can@vger.kernel.org,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
"Vincent Mailhol" <mailhol@kernel.org>
Subject: Re: [PATCH can-next v2 2/9] selftests: can: add J1939 test helper header and library
Date: Wed, 04 Nov 2026 16:37:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-197631@kernel.org> (raw)
In-Reply-To: <20261104-j1939-selftests-v2-2-cf797c83317b@pengutronix.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] selftests: can: silent skip in j1939_test_main() when protocol is missing
--
commit f577ac7f70eba0a6d39e0839d07a59a287fefd8a
Author: Oleksij Rempel <o.rempel@pengutronix.de>
selftests: can: add J1939 test helper header and library
This commit adds j1939_tests.h and j1939_lib.sh to provide shared C
helpers and vcan setup/teardown logic for the J1939 selftests.
> diff --git a/tools/testing/selftests/net/can/j1939_tests.h b/tools/testing/selftests/net/can/j1939_tests.h
> new file mode 100644
> index 0000000000000..78eb35f5b6b06
> --- /dev/null
> +++ b/tools/testing/selftests/net/can/j1939_tests.h
> @@ -0,0 +1,724 @@
[ ... ]
> +/* Is the CAN protocol proto missing from this kernel? */
> +static inline bool can_proto_missing(int type, int proto)
> +{
> + int probe = socket(PF_CAN, type, proto);
> +
> + if (probe < 0)
> + return errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT;
> +
> + close(probe);
> + return false;
> +}
> +
> +/*
> + * Body of each test's main(): require CANIF in the environment and a kernel
> + * that supports CAN_J1939 and CAN_RAW, then run the harness. Skip when any
> + * of them is missing.
> + */
> +static inline int j1939_test_main(int argc, char **argv)
> +{
> + char *ifname = getenv("CANIF");
> +
> + if (!ifname) {
> + fprintf(stderr, "# CANIF must name the test interface\n");
> + return KSFT_SKIP;
> + }
> + strncpy(CANIF, ifname, sizeof(CANIF) - 1);
> +
> + if (can_proto_missing(SOCK_DGRAM, CAN_J1939) ||
> + can_proto_missing(SOCK_RAW, CAN_RAW))
> + return KSFT_SKIP;
[Severity: Low]
In tools/testing/selftests/net/can/j1939_tests.h, when can_proto_missing()
returns true because socket(PF_CAN, SOCK_DGRAM, CAN_J1939) or
socket(PF_CAN, SOCK_RAW, CAN_RAW) fails with EAFNOSUPPORT or
EPROTONOSUPPORT, j1939_test_main() returns KSFT_SKIP without printing why
the test was skipped.
Since j1939_run() in tools/testing/selftests/net/can/j1939_lib.sh only
passes J1939_TEST_PROG to ret_set_ksft_status on a skip exit code, could
j1939_test_main() print a message stating which protocol support is missing
(similar to the CANIF check right above it) so the skip reason is visible
in the test output?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104-j1939-selftests-v2-0-cf797c83317b@pengutronix.de?part=2
next prev parent reply other threads:[~2026-11-04 16:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 16:17 [PATCH can-next v2 0/9] selftests: can: add J1939 socket and transport tests Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 1/9] selftests: can: install net/lib.sh with the CAN tests Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 2/9] selftests: can: add J1939 test helper header and library Oleksij Rempel
2026-11-04 16:37 ` sashiko-bot [this message]
2026-11-04 16:17 ` [PATCH can-next v2 3/9] selftests: can: add J1939 base functional tests Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 4/9] selftests: can: add J1939 socket option and metadata tests Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 5/9] selftests: can: add J1939 addressing and concurrency tests Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 6/9] selftests: can: add J1939 wire-format tests against CAN_RAW Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 7/9] selftests: can: add J1939 TP/ETP multi-frame " Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 8/9] selftests: can: cover J1939 transport abort and timeout paths Oleksij Rempel
2026-11-04 16:17 ` [PATCH can-next v2 9/9] selftests: can: check SO_J1939_PROMISC receive effect Oleksij Rempel
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=sashiko-outbox-197631@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox