From: sashiko-bot@kernel.org
To: "Vaibhav Jain" <vaibhav@linux.ibm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] kunit: Add ability to skip entire test suites
Date: Thu, 04 Jun 2026 16:47:11 +0000 [thread overview]
Message-ID: <20260604164711.8D46A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604162805.556135-2-vaibhav@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The newly added `suite->status` field is not reset in `kunit_init_suite()`, leading to a sticky skipped state across multiple debugfs runs.
- [Medium] Bypassing `suite_exit()` when `suite_init()` skips a test suite violates standard kernel initialization contracts and forces resource leaks.
--
commit b745c49805409babd4338da1946b7eb586892485
Author: Vaibhav Jain <vaibhav@linux.ibm.com>
kunit: Add ability to skip entire test suites
This commit adds a status field to struct kunit_suite to allow suite_init
callbacks to mark a suite as skipped. When a suite is marked as skipped,
all test cases within the suite are bypassed without execution.
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index 99773e000e1b7..989acc770265d 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
[ ... ]
> @@ -795,12 +798,20 @@ int kunit_run_tests(struct kunit_suite *suite)
> /* Taint the kernel so we know we've run tests. */
> add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
>
> + if (suite->status == KUNIT_SKIPPED)
> + goto suite_end;
> +
[Severity: Medium]
Does this cause the suite to remain permanently skipped on subsequent runs?
If a test suite is executed via debugfs and gets skipped, suite->status
becomes KUNIT_SKIPPED. Because kunit_init_suite() does not reset
suite->status back to KUNIT_SUCCESS, this check will immediately bypass
the suite on all subsequent debugfs runs, preventing re-evaluation
of runtime prerequisites.
> if (suite->suite_init) {
> suite->suite_init_err = suite->suite_init(suite);
> if (suite->suite_init_err) {
> + suite->status = KUNIT_FAILURE;
> kunit_err(suite, KUNIT_SUBTEST_INDENT
> "# failed to initialize (%d)", suite->suite_init_err);
> goto suite_end;
> +
> + } else if (suite->status == KUNIT_SKIPPED) {
> + /* Skip this kunit suite */
> + goto suite_end;
[Severity: Medium]
Will this leak resources allocated during suite_init() prior to the skip?
Standard kernel initialization patterns guarantee that if an init function
returns 0 (success), the corresponding exit function will be called.
If suite_init() allocates resources, then sets suite->status to
KUNIT_SKIPPED and returns 0, the goto suite_end bypasses the
suite->suite_exit(suite) call.
Does this force test authors to manually free resources before returning 0
when skipping, or should the exit function still be called here?
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260604162805.556135-1-vaibhav@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-06-04 16:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 16:27 [PATCH 0/2] kunit: Add support for skipping entire test suites Vaibhav Jain
2026-06-04 16:28 ` [PATCH 1/2] kunit: Add ability to skip " Vaibhav Jain
2026-06-04 16:47 ` sashiko-bot [this message]
2026-06-05 5:09 ` David Gow
2026-06-08 9:04 ` Vaibhav Jain
2026-06-04 16:28 ` [PATCH 2/2] kunit: Add example of test suite that can be skipped at runtime Vaibhav Jain
2026-06-04 16:42 ` sashiko-bot
2026-06-05 5:10 ` David Gow
2026-06-08 8:41 ` Vaibhav Jain
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=20260604164711.8D46A1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vaibhav@linux.ibm.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox