From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5 1/7] tst_kvercmp: Factor out error handling
Date: Wed, 12 Aug 2026 12:50:10 +0200 [thread overview]
Message-ID: <anxP4sEfKLBtnDH3@yuki.lan> (raw)
In-Reply-To: <20260810160048.1040517-2-pvorel@suse.cz>
Hi!
> -int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)
> +static int tst_parse_kver_(const char *str_kver, int *v1, int *v2, int *v3)
> {
> const char *str = str_kver;
>
> @@ -81,17 +81,28 @@ int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)
> return 0;
> }
As I said this is changed into static function hence the tst_ prefix
should be dropped.
> -int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3)
> +int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)
> {
> - int a1, a2, a3;
> - int testver, currver;
> + int rc;
> +
> + rc = tst_parse_kver_(str_kver, v1, v2, v3);
>
> - if (tst_parse_kver(cur_kver, &a1, &a2, &a3)) {
> + if (rc) {
> tst_resm(TWARN,
> "Invalid kernel version %s, expected %%d.%%d.%%d",
> - cur_kver);
> + str_kver);
> }
>
> + return rc;
> +}
> +
> +int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3)
> +{
> + int a1, a2, a3;
> + int testver, currver;
> +
> + tst_parse_kver(cur_kver, &a1, &a2, &a3);
> +
> testver = (r1 << 20) + (r2 << 10) + r3;
> currver = (a1 << 20) + (a2 << 10) + a3;
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 9c5f2617fe..a147521e9d 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1067,11 +1067,7 @@ static bool check_kver(const char *min_kver, const int brk_nosupp)
> char *msg;
> int v1, v2, v3;
>
> - if (tst_parse_kver(min_kver, &v1, &v2, &v3)) {
> - tst_res(TWARN,
> - "Invalid kernel version %s, expected %%d.%%d.%%d",
> - min_kver);
> - }
> + tst_parse_kver(min_kver, &v1, &v2, &v3);
>
> if (tst_kvercmp(v1, v2, v3) < 0) {
> msg = "The test requires kernel %s or newer";
> --
> 2.55.0
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-12 10:50 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 16:00 [LTP] [PATCH v5 0/7] Add support for .max_kver Petr Vorel
2026-08-10 16:00 ` [LTP] [PATCH v5 1/7] tst_kvercmp: Factor out error handling Petr Vorel
2026-08-10 16:57 ` [LTP] " linuxtestproject.agent
2026-08-10 17:03 ` Petr Vorel
2026-08-11 7:01 ` [LTP] [PATCH v5 1/7] " Andrea Cervesato via ltp
2026-08-12 10:50 ` Cyril Hrubis [this message]
2026-08-10 16:00 ` [LTP] [PATCH v5 2/7] lib: Rename function check_kver() => check_min_kver() Petr Vorel
2026-08-10 16:00 ` [LTP] [PATCH v5 3/7] lib: Add support for max_kver to struct tst_test and tst_fs Petr Vorel
2026-08-11 7:04 ` Andrea Cervesato via ltp
2026-08-12 11:05 ` Cyril Hrubis
2026-08-12 12:30 ` Petr Vorel
2026-08-12 12:36 ` Cyril Hrubis
2026-08-12 13:11 ` Petr Vorel
2026-08-12 12:44 ` Cyril Hrubis
2026-08-12 13:16 ` Petr Vorel
2026-08-12 11:06 ` Cyril Hrubis
2026-08-12 13:00 ` Petr Vorel
2026-08-10 16:00 ` [LTP] [PATCH v5 4/7] creat07: Avoid timeout on the test failure Petr Vorel
2026-08-11 7:04 ` Andrea Cervesato via ltp
2026-08-10 16:00 ` [LTP] [PATCH v5 5/7] creat07: execve04: Remove version check, add linux-git Petr Vorel
2026-08-10 16:00 ` [LTP] [PATCH v5 6/7] fanotify20: Skip on v7.2 Petr Vorel
2026-08-10 16:00 ` [LTP] [PATCH v5 7/7] lib: Add 2 basic tests for .min_kver && .max_kver Petr Vorel
2026-08-11 7:13 ` Andrea Cervesato via ltp
2026-08-11 8:49 ` Petr Vorel
2026-08-11 8:53 ` Andrea Cervesato via ltp
2026-08-11 10:10 ` Avinesh Kumar via ltp
2026-08-11 1:45 ` [LTP] [PATCH v5 0/7] Add support for .max_kver Li Wang
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=anxP4sEfKLBtnDH3@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.