From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Wei Yang <richard.weiyang@gmail.com>,
shuah@kernel.org, kees@kernel.org, luto@amacapital.net,
wad@chromium.org
Cc: linux-kselftest@vger.kernel.org, thomas.weissschuh@linutronix.de,
skhan@linuxfoundation.org
Subject: Re: [PATCH 3/3] selftests: harness: Add kselftest harness selftest with variant
Date: Mon, 16 Jun 2025 17:45:42 +0500 [thread overview]
Message-ID: <f5b58230-c5cf-4c4c-afdb-752f3fc5d233@collabora.com> (raw)
In-Reply-To: <20250616122338.32678-4-richard.weiyang@gmail.com>
On 6/16/25 5:23 PM, Wei Yang wrote:
> Each fixture could support variant. Add fixture with variant to verify
> the behavior, so we can validate for further change.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> .../kselftest_harness/harness-selftest.c | 34 +++++++++++++++++++
> .../harness-selftest.expected | 22 +++++++++---
> 2 files changed, 52 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/kselftest_harness/harness-selftest.c b/tools/testing/selftests/kselftest_harness/harness-selftest.c
> index b555493bdb4d..2fd5310b33c7 100644
> --- a/tools/testing/selftests/kselftest_harness/harness-selftest.c
> +++ b/tools/testing/selftests/kselftest_harness/harness-selftest.c
> @@ -118,6 +118,40 @@ TEST_F(fixture_setup_failure, pass) {
> TH_LOG("after");
> }
>
> +FIXTURE(fixture_variant) {
> + pid_t testpid;
> +};
> +
> +FIXTURE_VARIANT(fixture_variant)
> +{
> + int value;
> +};
> +
> +FIXTURE_VARIANT_ADD(fixture_variant, v32)
> +{
> + .value = 32,
> +};
> +
> +FIXTURE_VARIANT_ADD(fixture_variant, v64)
> +{
> + .value = 64,
> +};
> +
> +FIXTURE_SETUP(fixture_variant) {
> + TH_LOG("setup %d", variant->value);
> + self->testpid = getpid();
> +}
> +
> +FIXTURE_TEARDOWN(fixture_variant) {
> + TH_LOG("teardown same-process=%d", self->testpid == getpid());
> +}
> +
> +TEST_F(fixture_variant, pass) {
> + TH_LOG("before");
> + ASSERT_EQ(0, 0);
> + TH_LOG("after");
> +}
> +
> int main(int argc, char **argv)
> {
> /*
> diff --git a/tools/testing/selftests/kselftest_harness/harness-selftest.expected b/tools/testing/selftests/kselftest_harness/harness-selftest.expected
> index 97e1418c1c7e..ab081c5aba05 100644
> --- a/tools/testing/selftests/kselftest_harness/harness-selftest.expected
> +++ b/tools/testing/selftests/kselftest_harness/harness-selftest.expected
> @@ -1,6 +1,6 @@
> TAP version 13
> -1..9
> -# Starting 9 tests from 4 test cases.
> +1..11
> +# Starting 11 tests from 6 test cases.
> # RUN global.standalone_pass ...
> # harness-selftest.c:19:standalone_pass:before
> # harness-selftest.c:23:standalone_pass:after
> @@ -60,5 +60,19 @@ ok 8 fixture_parent.pass
> # pass: Test terminated by assertion
> # FAIL fixture_setup_failure.pass
> not ok 9 fixture_setup_failure.pass
> -# FAILED: 4 / 9 tests passed.
> -# Totals: pass:4 fail:5 xfail:0 xpass:0 skip:0 error:0
> +# RUN fixture_variant.v32.pass ...
> +# harness-selftest.c:141:pass:setup 32
> +# harness-selftest.c:150:pass:before
> +# harness-selftest.c:152:pass:after
> +# harness-selftest.c:146:pass:teardown same-process=1
> +# OK fixture_variant.v32.pass
> +ok 10 fixture_variant.v32.pass
> +# RUN fixture_variant.v64.pass ...
> +# harness-selftest.c:141:pass:setup 64
> +# harness-selftest.c:150:pass:before
> +# harness-selftest.c:152:pass:after
> +# harness-selftest.c:146:pass:teardown same-process=1
> +# OK fixture_variant.v64.pass
> +ok 11 fixture_variant.v64.pass
> +# FAILED: 6 / 11 tests passed.
> +# Totals: pass:6 fail:5 xfail:0 xpass:0 skip:0 error:0
next prev parent reply other threads:[~2025-06-16 12:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 12:23 [PATCH 0/3] Add kselftest harness selftest with variant Wei Yang
2025-06-16 12:23 ` [PATCH 1/3] selftests: correct one typo in comment Wei Yang
2025-06-17 7:31 ` Thomas Weißschuh
2025-06-17 23:52 ` Wei Yang
2025-06-16 12:23 ` [PATCH 2/3] selftests: print 0 if no test is chosen Wei Yang
2025-06-16 12:44 ` Muhammad Usama Anjum
2025-06-16 22:49 ` Wei Yang
2025-06-16 12:23 ` [PATCH 3/3] selftests: harness: Add kselftest harness selftest with variant Wei Yang
2025-06-16 12:45 ` Muhammad Usama Anjum [this message]
2025-06-18 0:05 ` Wei Yang
2025-06-17 7:35 ` Thomas Weißschuh
2025-06-17 23:57 ` Wei Yang
2025-06-18 5:47 ` Thomas Weißschuh
2025-06-18 8:16 ` Wei Yang
2025-06-18 9:12 ` Wei Yang
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=f5b58230-c5cf-4c4c-afdb-752f3fc5d233@collabora.com \
--to=usama.anjum@collabora.com \
--cc=kees@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=richard.weiyang@gmail.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=wad@chromium.org \
/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;
as well as URLs for NNTP newsgroup(s).