Add support for .max_kver
v4 cover Add support for .max_kver
Hi all,
[RFC]
Li suggested [1] to .min_kver > .max_kver should be rejected, or at least reported as broken test metadata.
I decided to add check to metadata parser (that required to link metaparse.c against libltp.a). Runtime check with TWARN would be also good, but let's discuss that first (if not, I'll remove TODO from tst_test.c). Hence this part is [RFC].
Hopefully it's the last version :).
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/[email protected]/
Changes v3->v4:
* creat07: execve04: does not use max_kver, instead:
creat07: execve04: Remove version check, add linux-git
* New commits:
- tst_kvercmp: Factor out error handling
- tst_kvercmp: Factor out 2 kernels integer comparison
- [RFC] make: Allow to add LTP library as a dependency for host
- [RFC] metaparse: Check {min,max}_kver validity
Changes in 3rd commit
* Mention flag in doc/developers/writing_tests.rst
* Fix doc (agent):
- * on any stable release (test with ``min_kver = "7.1"`` runs also on kernel
+ * on any stable release (test with ``max_kver = "7.1"`` runs also on kernel
* Fix checkpatch style (agent):
- for (i=0, dots=0; max_kver[i]; i++)
+ for (i = 0, dots = 0; max_kver[i]; i++)
Link to v3:
https://patchwork.kernel.org/project/ltp/list/?series=1138093&state=*
https://lore.kernel.org/ltp/[email protected]/T/#t
Link to v2:
https://lore.kernel.org/ltp/[email protected]/T/#t
Link to v1:
https://lore.kernel.org/ltp/[email protected]/T/#t
https://patchwork.ozlabs.org/project/ltp/list/?series=516120&state=*
Petr Vorel (9):
tst_kvercmp: Factor out error handling
lib: Rename function check_kver() => check_min_kver()
lib: Add support for max_kver to struct tst_test and tst_fs
creat07: execve04: Remove version check, add linux-git
fanotify20: Skip on v7.2
lib: Add basic test for .min_kver && .max_kver
tst_kvercmp: Factor out 2 kernels integer comparison [RFC] make: Allow to add LTP library as a dependency for host [RFC] metaparse: Check {min,max}_kver validity
doc/developers/writing_tests.rst | 3 + include/mk/generic_leaf_target.inc | 5 +- include/tst_kvercmp.h | 12 ++++ include/tst_test.h | 13 +++- lib/newlib_tests/.gitignore | 1 + lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/tst_min_kver_max_kver.c | 21 +++++++ lib/tst_kvercmp.c | 35 ++++++++--- lib/tst_test.c | 61 ++++++++++++++++--- metadata/Makefile | 6 +- metadata/metaparse.c | 33 ++++++++++ testcases/kernel/syscalls/creat/creat07.c | 20 +++--- testcases/kernel/syscalls/execve/execve04.c | 24 ++++---- .../kernel/syscalls/fanotify/fanotify20.c | 4 ++ 14 files changed, 194 insertions(+), 45 deletions(-) create mode 100644 lib/newlib_tests/tst_min_kver_max_kver.c
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 1/9 tst_kvercmp: Factor out error handling
Error check was already on 2 places (and possibly more will be added in the future).
---
New in v4.
lib/tst_kvercmp.c | 23 +++++++++++++++++------ lib/tst_test.c | 6 +----- 2 files changed, 18 insertions(+), 11 deletions(-)
lib/tst_kvercmp.c +17 -6
@@ -45,7 +45,7 @@ static char *parse_digit(const char *str, int *d)return end; } -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 ; } -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;
lib/tst_test.c +1 -5
@@ -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" ;
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
Hi Petr,
Quoted 1 line · Petr Vorel
tst_kvercmp: Factor out error handling
--- [PATCH 2/9] ---
Quoted 2 lines
This is a preparation for struct
tst_testmax_kvermember in the next commit.
Could this explain the distinction between minimum- and maximum-version checks without referring to the next patch? Commit messages in a series should be self-contained.
--- [PATCH 5/9] ---
Review
Quoted 1 line
(quoted diff) +1
-0+ .max_kver = "7.1",
Could only the FAN_REPORT_PIDFD | FAN_REPORT_TID case be adjusted or split instead? This skips every case on Linux 7.2 and newer, including FAN_REPORT_PIDFD | FAN_REPORT_FID | FAN_REPORT_DFID_NAME, whose expected behavior did not change. That permanently removes its regression coverage on newer kernels.
--- [PATCH 6/9] ---
Review
Quoted 2 lines
(quoted diff) +2
-0+ .min_kver = "4.4", + .max_kver = "5.0",
How does this exercise the successful min/max path on current kernels? It exits with TCONF on every kernel newer than 5.0, and runtest.sh accepts TCONF as success without calling do_test(). Could the upper bound be made safely higher than the running kernel, or otherwise deterministic?
--- [PATCH 7/9] ---
Quoted 10 lines
+/**
+ *tst_kver_cmp()- Compare two kernel versions, versions passed by 3 integers.
+ *
+ * @a1: First kernel major version.
+ * @a2: First kernel minor version.
+ * @a3: First kernel patch level.
+ * @b1: Second kernel major version.
+ * @b2: Second kernel minor version.
+ * @b3: Second kernel patch level.
+ */
Could this document the return value? Callers need to know that a negative result means the first version is older, zero means equal, and a positive result means newer.
Quoted 2 lines
This will be heavily used in
metaparse.c(speedup of metadata generation) in the next commit.
Could the reusable comparison need be explained without referring to the next patch? Commit messages in a series should be self-contained.
--- [PATCH 8/9] ---
Quoted 1 line
Will be used for
metadata.cin the next commit.
Could this describe the host-tool link or build-order problem solved by the rule? The current body relies on the next patch and does not explain why host targets need MAKE_DEPS.
--- [PATCH 9/9] ---
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (min_kver && max_kver) { + if (tst_kver_cmp(a1, a2, a3, b1, b2, b3) < 0) {
Could this apply the same two-component max_kver semantics as check_max_kver()? For example, min_kver "7.1.5" and max_kver "7.1" is rejected as 7.1.5 > 7.1.0, although the API defines max_kver "7.1" to include every 7.1.x kernel.
Review
Quoted 4 lines
(quoted diff) +3
-0+include $(top_srcdir)/include/mk/testcases.mk +metaparse: HOST_CFLAGS += -I$(abs_srcdir)/../include -L$(abs_builddir)/../lib +metaparse: HOST_LDLIBS += -lltp
How will this work for cross builds? metaparse is built with HOSTCC, while testcases.mk builds libltp.a with the target CC. A host linker cannot consume a target-architecture archive. Could the parsing and comparison code used by metaparse be built with HOSTCC or shared without linking the target library?
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
In reply to Petr VorelHi Petr,
Quoted 1 line · Petr Vorel
tst_kvercmp: Factor out error handling
--- [PATCH 1/9] ---
Quoted 1 line
+static int
_tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)
Could this helper use an unreserved name such as parse_kver or tst_parse_kver_internal? Identifiers beginning with an underscore are reserved at file scope by C, and LTP's C rules explicitly prohibit them.
--- [PATCH 6/9] ---
Review
Quoted 5 lines
(quoted diff) +5
-0+static struct tst_test test = { + .min_kver = "4.4", + .max_kver = "5.0", + .test_all = do_test, +};
How can this self-test verify that a valid range is run? On kernel 7.2, the framework exits with TCONF before do_test() is called, and runtest.sh accepts TCONF as success. The test therefore remains green even if running a test inside a valid min/max range is broken. Could the test use a range containing the running kernel, or assert the gating result another way?
--- [PATCH 7/9] ---
Quoted 10 lines
+/**
+ *tst_kver_cmp()- Compare two kernel versions, versions passed by 3 integers.
+ *
+ * @a1: First kernel major version.
+ * @a2: First kernel minor version.
+ * @a3: First kernel patch level.
+ * @b1: Second kernel major version.
+ * @b2: Second kernel minor version.
+ * @b3: Second kernel patch level.
+ */
Could this public API document its return value with the required kernel-doc
Return: section? It should describe the negative, zero, and positive cases.
--- [PATCH 9/9] ---
Review
Quoted 2 lines
(quoted diff) +2
-0+metaparse: HOST_CFLAGS += -I$(abs_srcdir)/../include -L$(abs_builddir)/../lib +metaparse: HOST_LDLIBS += -lltp
How does this work for cross builds? metaparse is linked with HOSTCC, while lib/libltp.a is built with the target CC. HOSTCC cannot link target-architecture objects, so metadata generation fails with an incompatible object format. Could the needed parsing and comparison code be built with HOSTCC and kept free of target-library dependencies instead?
Review
Quoted 3 lines
(quoted diff) +3
-0+ if (min_kver && max_kver) { + if (tst_kver_cmp(a1, a2, a3, b1, b2, b3) < 0) { + fprintf(stderr, "%s: min_kver (%s) > max_kver (%s)\n",
Could this comparison apply the documented two-component max_kver semantics? For example, min_kver "7.1.5" and max_kver "7.1" is a valid nonempty range because max_kver "7.1" includes every 7.1.x stable release. This literal comparison treats the maximum as 7.1.0 and rejects that range.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
In reply to Petr VorelHi Petr,
Quoted 1 line · Petr Vorel
tst_kvercmp: Factor out error handling
--- [PATCH 1/9] ---
Quoted 1 line
+static int
_tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)
Could this helper use an unreserved name such as parse_kver()? Identifiers beginning with an underscore are reserved at file scope and are explicitly disallowed by the LTP C coding rules.
--- [PATCH 4/9] ---
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (TST_RET != -1) { + tst_res(TFAIL, "creat() succeeded unexpectedly"); + return; + }
Could this path kill and reap pid before returning? This patch exposes the path on affected 6.11 and 6.12 kernels, but the child remains executing creat07_child. run_tests() then blocks in tst_reap_children() instead of finishing with the reported TFAIL, and the test eventually times out.
--- [PATCH 5/9] ---
Review
Quoted 4 lines
static struct
tst_testtest = {(quoted diff) +1
-0.setup = do_setup, + .max_kver = "7.1", .test = do_test,
Could only the FAN_REPORT_PIDFD | FAN_REPORT_TID case be adjusted or omitted on 7.2 and newer? The second case remains valid, and no other fanotify C test initializes a group with FAN_REPORT_PIDFD | FAN_REPORT_FID | FAN_REPORT_DFID_NAME. Since 7.2 is already stable, gating the whole test immediately removes that coverage on current kernels.
--- [PATCH 6/9] ---
Review
Quoted 5 lines
(quoted diff) +5
-0+static struct tst_test test = { + .min_kver = "4.4", + .max_kver = "5.0", + .test_all = do_test, +};
Could the bounds include kernels used by current CI? On stable 7.2, and every kernel newer than 5.0.x, the library exits with TCONF before do_test() runs. The test therefore does not perform the CI check described by the commit message.
--- [PATCH 9/9] ---
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (min_kver && max_kver) { + if (tst_kver_cmp(a1, a2, a3, b1, b2, b3) < 0) {
Could this validation use the same two-component maximum semantics as check_max_kver()? For example, min_kver "7.1.5" and max_kver "7.1" form a valid interval because max_kver "7.1" permits every 7.1.x kernel, but this comparison rejects it as min_kver greater than max_kver.
Review
Quoted 2 lines
(quoted diff) +2
-0+include $(top_srcdir)/include/mk/testcases.mk +metaparse: HOST_LDLIBS += -lltp
Could the required helpers instead be compiled with HOSTCC? testcases.mk builds libltp.a with the target CC, while metaparse is linked with HOSTCC. During cross compilation, the target objects cannot be linked into the host executable, so metadata generation fails with an incompatible object format.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
In reply to Petr VorelHi Petr,
Quoted 1 line · Petr Vorel
tst_kvercmp: Factor out error handling
--- [PATCH 1/9] ---
Quoted 1 line
static int
_tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)
Could this be renamed to parse_kver? File-scope identifiers beginning with an underscore are reserved by C, and LTP's coding rules prohibit such names.
--- [PATCH 2/9] ---
Quoted 2 lines
This is a preparation for struct
tst_testmax_kvermember in the next commit.
Could the motivation be stated without referring to the next patch? Each commit message should stand on its own rather than depend on series position.
--- [PATCH 4/9] ---
Quoted 4 lines
if (TST_RET != -1) {
tst_res(TFAIL, "creat() succeeded unexpectedly");
return;
}Could this path kill and reap pid before returning? Removing the version gate makes it reachable on affected 6.11 and 6.12 kernels, but the child remains paused indefinitely. The framework then blocks in tst_reap_children() until the watchdog terminates the test instead of returning the intended TFAIL.
Quoted 1 line
TEST(execve(TEST_APP, argv, environ));
How is the writer child released when execve() succeeds on an affected kernel? The test process is replaced by execve_child, which reports TFAIL and exits, while the writer remains blocked in TST_CHECKPOINT_WAKE_AND_WAIT(0) and becomes an orphan.
--- [PATCH 5/9] ---
Quoted 1 line
.max_kver = "7.1",
Could the test keep running and only adjust the expected result of FAN_REPORT_PIDFD | FAN_REPORT_TID on kernels supporting thread pidfds? This test-wide limit also removes theFAN_REPORT_PIDFD | FAN_REPORT_FID | FAN_REPORT_DFID_NAME case on 7.2 and all newer kernels, and that exact combination is not tested elsewhere in LTP.
--- [PATCH 6/9] ---
Quoted 2 lines
.min_kver = "4.4", .max_kver = "5.0",
How can this exercise do_test() on current CI kernels? The current kernel must lie between the bounds; min_kver being less than max_kver is not sufficient. With this maximum, including on stable 7.2, the self-test only reports TCONF and never tests the new success path.
--- [PATCH 7/9] ---
Quoted 1 line
int
tst_kver_cmp(int a1, int a2, int a3, int b1, int b2, int b3);
Could the new public function's kernel-doc include a Return: section describing the comparison result?
Quoted 2 lines
This will be heavily used in
metaparse.c(speedup of metadata generation) in the next commit.
Could this motivation be stated without referring to the next patch? Each commit message should stand on its own.
--- [PATCH 8/9] ---
Quoted 1 line
Will be used for
metadata.cin the next commit.
Could the commit message instead explain why host targets need access to MAKE_DEPS without depending on a later patch?
--- [PATCH 9/9] ---
Quoted 1 line
metaparse:
HOST_LDLIBS+= -lltp
How can this work for a cross-compilation? metaparse is built with HOSTCC, but -lltp resolves to lib/libltp.a built with the target CC, so the host linker cannot consume the archive. Could the version helper be compiled with HOSTCC, or moved into an architecture-independent host library?
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
Hi all,
Quoted 11 lines
Hi Petr,
Quoted 1 line · Petr Vorel
tst_kvercmp: Factor out error handling--- [PATCH 1/9] ---
Quoted 1 line
static int
_tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)Could this be renamed to
parse_kver? File-scope identifiers beginning with an underscore are reserved by C, and LTP's coding rules prohibit such names.
I thought this is wrong, because we have functions with underscore, but it's trailing underscore, not the leading one.
=> I'll rename to tst_parse_kver_().
Also, agent does not know about LTP rule to have functions in lib with leading tst_.
Quoted 7 lines
--- [PATCH 2/9] ---
Quoted 2 lines
This is a preparation for struct
tst_testmax_kvermember in the next commit.Could the motivation be stated without referring to the next patch? Each commit message should stand on its own rather than depend on series position.
Well, we try to split code into commits to be easily revieweable. With that sometimes is hard to avoid referring to commits. Preparation for other changes separated into it's own commit helps is an explanation itself.
=> Consider as irrelevant.
Quoted 11 lines
--- [PATCH 4/9] ---
Quoted 4 lines
if (TST_RET != -1) { tst_res(TFAIL, "creat() succeeded unexpectedly"); return; }Could this path kill and reap pid before returning? Removing the version gate makes it reachable on affected 6.11 and 6.12 kernels, but the child remains paused indefinitely. The framework then blocks in
tst_reap_children()until the watchdog terminates the test instead of returning the intended TFAIL.
=> Indeed, this is bug for creat07.c, at least on SLE16 kernel which is based on 6.12, where test hangs until timeouts on:
creat07.c:43: TFAIL: creat() succeeded unexpectedly
I guess I'll simply use goto to do the needed cleanup:
+++ testcases/kernel/syscalls/creat/creat07.c
@@ -41,7 +41,7 @@ static void verify_creat(void)
if (TST_RET != -1) {
tst_res(TFAIL, "creat() succeeded unexpectedly");
- return;
+ goto kill;
}
if (TST_ERR == ETXTBSY)
@@ -49,6 +49,7 @@ static void verify_creat(void)
else
tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");+kill:
SAFE_KILL(pid, SIGKILL);
SAFE_WAITPID(pid, NULL, 0); }
---
execve04.c simply fails on that kernel which is IMHO correct (not hiding bugs):
execve_child.c:27: TFAIL: execve_child shouldn't be executed
Quoted 6 lines
Quoted 1 line
TEST(execve(TEST_APP, argv, environ));How is the writer child released when
execve()succeeds on an affected kernel? The test process is replaced byexecve_child, which reports TFAIL and exits, while the writer remains blocked inTST_CHECKPOINT_WAKE_AND_WAIT(0)and becomes an orphan.
I hope the above patch fixes that. Shouldn't be this fixed separately (regardless on a removed .min_kver), it can be problematic on any kernel version.
Quoted 9 lines
--- [PATCH 5/9] ---
Quoted 1 line
.max_kver = "7.1",Could the test keep running and only adjust the expected result of
FAN_REPORT_PIDFD|FAN_REPORT_TIDon kernels supporting thread pidfds? This test-wide limit also removes theFAN_REPORT_PIDFD|FAN_REPORT_FID|FAN_REPORT_DFID_NAMEcase on 7.2 and all newer kernels, and that exact combination is not tested elsewhere in LTP.
No, we agreed, this is ok (I'm explaining this second time and I suppose I will have to do it on all patchset versions I'll send).
Quoted 9 lines
--- [PATCH 6/9] ---
Quoted 2 lines
.min_kver = "4.4", .max_kver = "5.0",How can this exercise
do_test()on current CI kernels? The current kernel must lie between the bounds;min_kverbeing less thanmax_kveris not sufficient. With this maximum, including on stable 7.2, the self-test only reports TCONF and never tests the new success path.
I deliberately wanted to get TCONF on the current kernel, i.e. the fact than using both will result in TCONF not in TBROK. Also, it does not matter if the test TCONF due old version or run and then TPASS, it's about testing library setup() run with .min_kver and .max_kver (test itself does nothing). Also any kernel version will sooner later be old and thus TCONF, why not to do it now? Not it's also a test that any old version will just TCONF not TBROK. I try to document it better in the test.
Quoted 6 lines
--- [PATCH 7/9] ---
Quoted 1 line
int
tst_kver_cmp(int a1, int a2, int a3, int b1, int b2, int b3);Could the new public function's kernel-doc include a Return: section describing the comparison result?
Commit will be removed in the next version.
Quoted 6 lines
Quoted 2 lines
This will be heavily used in
metaparse.c(speedup of metadata generation) in the next commit.Could this motivation be stated without referring to the next patch? Each commit message should stand on its own.
Quoted 6 lines
--- [PATCH 8/9] ---
Quoted 1 line
Will be used for
metadata.cin the next commit.Could the commit message instead explain why host targets need access to
MAKE_DEPSwithout depending on a later patch?
Commit will be removed in the next version.
Quoted 8 lines
--- [PATCH 9/9] ---
Quoted 1 line
metaparse:
HOST_LDLIBS+= -lltpHow can this work for a cross-compilation? metaparse is built with HOSTCC, but -lltp resolves to
lib/libltp.abuilt with the target CC, so the host linker cannot consume the archive. Could the version helper be compiled with HOSTCC, or moved into an architecture-independent host library?
Commit will be removed in the next version.
Quoted 11 lines
Verdict - Needs revision
---
Note:The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
Hi!
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
tst_kvercmp: Factor out error handling--- [PATCH 1/9] ---
Quoted 1 line
static int
_tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)Could this be renamed to
parse_kver? File-scope identifiers beginning with an underscore are reserved by C, and LTP's coding rules prohibit such names.
Quoted 7 lines
I thought this is wrong, because we have functions with underscore, but it's trailing underscore, not the leading one.
=> I'll rename to
tst_parse_kver_().Also, agent does not know about LTP rule to have functions in lib with leading
tst_.
This is a static function, so the identifier is not visible outside of the file, therefore there is no need for the tst_ prefix. On the contrary it's better if there is no prefix so that it's clear that it's not external API.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tst_kvercmp: Factor out error handling
Quoted 15 lines
Hi!
Quoted 13 lines
Quoted 8 lines
Quoted 1 line
tst_kvercmp: Factor out error handling--- [PATCH 1/9] ---
Quoted 1 line
static int
_tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)Could this be renamed to
parse_kver? File-scope identifiers beginning with an underscore are reserved by C, and LTP's coding rules prohibit such names.I thought this is wrong, because we have functions with underscore, but it's trailing underscore, not the leading one.
=> I'll rename to
tst_parse_kver_().
Quoted 7 lines
Quoted 2 lines
Also, agent does not know about LTP rule to have functions in lib with leading
tst_.This is a static function, so the identifier is not visible outside of the file, therefore there is no need for the
tst_prefix. On the contrary it's better if there is no prefix so that it's clear that it's not external API.
OK, agent was correct to user parse_kver().
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v4 1/9] tst_kvercmp: Factor out error handling
In reply to Petr VorelHi Petr,
We got 4 reviews..it seems like there's a problem with the CI and the new instance is not setting the state correctly, which is used by the script to recognize if patch was already reviewed or not. I will fix it.
Anyway, we can say you had enough material to fix the series :-)
Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v4 1/9] tst_kvercmp: Factor out error handling
Hi Andrea,
Quoted 6 lines
Hi Petr,
We got 4 reviews..it seems like there's a problem with the CI and the new instance is not setting the state correctly, which is used by the script to recognize if patch was already reviewed or not. I will fix it.
Thanks for your time and effort to fix it.
Quoted 1 line
Anyway, we can say you had enough material to fix the series :-)
If you mean agent complains [1] they are mostly wrong. (The only correct one is for 9th commit which I'm going to drop).
Anyway, I'll send next version without last 3 commits (2 of them RFC), because only that part was problematic (even v3 was ready and could have been merged with 2 minor fixes changed before merge).
I'll reply to agent objections [1] before sending and I guess I'll have to do it again in next version, unless there is some shared context between patchsets. But I'm getting to understand Wei's frustration to fight against agent's false positives :).
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/[email protected]/
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 2/9 lib: Rename function check_kver() => check_min_kver()
In reply to Petr VorelThis is a preparation for struct tst_test max_kver member in the next commit.
---
The same as in v3.
lib/tst_test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/tst_test.c +5 -5
@@ -1058,11 +1058,11 @@ static void do_exit(int ret) }/* -* Check for the required kernel version. +* Check for the minimal required kernel version. * * return: true if the kernel version is high enough, false otherwise. */ -static bool check_kver (const char *min_kver,const int brk_nosupp) +static bool check_min_kver (const char *min_kver,const int brk_nosupp) {char *msg;int v1, v2, v3;
@@ -1457,7 +1457,7 @@ static void do_setup(int argc, char *argv[])tst_brk (TCONF ,"Test needs to be run as root" );if (tst_test->min_kver) -check_kver (tst_test->min_kver,1 ); +check_min_kver (tst_test->min_kver,1 );if (tst_test->skip_in_lockdown &&tst_lockdown_enabled () >0 )tst_brk (TCONF ,"Kernel is locked down, skipping test" );
@@ -1580,7 +1580,7 @@ static void do_setup(int argc, char *argv[])tst_check_cmd (tst_test->filesystems->mkfs_ver,1 );if (tst_test->filesystems && tst_test->filesystems->min_kver) -check_kver (tst_test->filesystems->min_kver,1 ); +check_min_kver (tst_test->filesystems->min_kver,1 );prepare_device (tst_test->filesystems); }
@@ -1984,7 +1984,7 @@ static void run_tcase_on_fs(struct tst_fs *fs, const char *fs_type)if (fs->mkfs_ver && !tst_check_cmd (fs->mkfs_ver,0 ))return ; -if (fs->min_kver && !check_kver (fs->min_kver,0 )) +if (fs->min_kver && !check_min_kver (fs->min_kver,0 ))return ;prepare_device (fs);
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 3/9 lib: Add support for max_kver to struct tst_test and tst_fs
In reply to Petr Vorelmax_kver adds a support to require a maximal kernel version the test can run on. e.g. "7.2" (mainline release) or "6.1.180" (stable release).
NOTE: Mainline release is sufficient on any stable release (test with .min_kver = "7.1" runs also on kernel 7.1.5). Stable releases are compared as expected.
---
Changes v3->v4:
* Mention flag in doc/developers/writing_tests.rst
* Fix doc (agent):
- * on any stable release (test with ``min_kver = "7.1"`` runs also on kernel
+ * on any stable release (test with ``max_kver = "7.1"`` runs also on kernel
* Fix checkpatch style (agent):
- for (i=0, dots=0; max_kver[i]; i++)
+ for (i = 0, dots = 0; max_kver[i]; i++)
doc/developers/writing_tests.rst | 3 +++ include/tst_test.h | 13 +++++++++- lib/tst_test.c | 43 ++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-)
doc/developers/writing_tests.rst +3 -0
@@ -402,6 +402,9 @@ LTP C And Shell Test API Comparison * - .min_kver - TST_MIN_KVER + * - .max_kver + - not implemented + * - .min_mem_avail - not applicable
include/tst_test.h +12 -1
@@ -280,6 +280,9 @@ struct tst_ulimit_val {* * @min_kver: A minimum kernel version supporting the filesystem which has been * created with mkfs. +* +* @max_kver: A maximum kernel version supporting the filesystem which has been +* created with mkfs. */ struct tst_fs {const char *type;
@@ -292,6 +295,7 @@ struct tst_fs {const void *mnt_data;const char *min_kver; +const char *max_kver; };/**
@@ -301,7 +305,13 @@ struct tst_fs {* and each time passed an increasing counter value. * @options: An NULL optstr terminated array of struct tst_option. * -* @min_kver: A minimal kernel version the test can run on. e.g. "3.10". +* @min_kver: A minimal kernel version the test can run on. e.g. "4.4" (mainline +* release) or "6.1.180" (stable release). +* +* @max_kver: A maximal kernel version the test can run on. e.g. "7.2" (mainline +* release) or "6.1.180" (stable release). NOTE: Mainline release is sufficient +* on any stable release (test with ``max_kver = "7.1"`` runs also on kernel +* 7.1.5). Stable releases are compared as expected. * * @supported_archs: A NULL terminated array of architectures the test runs on * e.g. {"x86_64, "x86", NULL}. Calls tst_is_on_arch() to
@@ -551,6 +561,7 @@ struct tst_fs {struct tst_option *options;const char *min_kver; +const char *max_kver;const char *const *supported_archs;
lib/tst_test.c +43 -0
67 lines not on this page · raw message
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 4/9 creat07: execve04: Remove version check, add linux-git
In reply to Petr VorelKernel commit 2a010c412853 ("fs: don't block i_writecount during exec") from 6.11-rc1 was reverted in 3b832035387f ("Revert "fs: don't block i_writecount during exec"") in v6.13-rc1 and backported into v6.11.11 and v6.12.2. Due LTP "no hide kernel bugs" policy remove kernel version limitation and add missing linux-git tag.
---
New in v4 (replaced adding max_kver in previous versions).
testcases/kernel/syscalls/creat/creat07.c | 20 ++++++++--------- testcases/kernel/syscalls/execve/execve04.c | 24 ++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-)
testcases/kernel/syscalls/creat/creat07.c +10 -10
@@ -6,6 +6,12 @@/*\ * Check that :manpage:`creat(2)` sets ETXTBSY correctly. +* +* NOTE: write to executed file was allowed in 6.11-rc1: +* 2a010c412853 ("fs: don't block i_writecount during exec") +* but then reverted in v6.13-rc1: +* 3b832035387f ("Revert "fs: don't block i_writecount during exec""), +* backported into v6.11.11 and v6.12.2. */ #include <sys/types.h>
@@ -47,20 +53,14 @@ static void verify_creat(void)SAFE_WAITPID (pid,NULL ,0 ); } -static void setup (void ) -{ -if ((tst_kvercmp (6 ,11 ,0 )) >=0 ) { -tst_brk (TCONF ,"Skipping test, write to executed file is " -"allowed since 6.11-rc1.\n" -"2a010c412853 (\"fs: don't block i_writecount during exec\")" ); - } -} -static struct tst_test test = { - .setup = setup, .test_all = verify_creat, .needs_checkpoints =1 , .forks_child =1 , + .tags = (const struct tst_tag []) { + {"linux-git" ,"3b832035387ff508fdcf0fba66701afc78f79e3d" }, + {} + }, .resource_files = (const char *const []) {TEST_APP ,NULL
testcases/kernel/syscalls/execve/execve04.c +12 -12
@@ -9,8 +9,14 @@*/ /*\ -* Attempt to :manpage:`execve(2)` a file which is being opened by another process for -* writing fails with ETXTBSY. +* Attempt to :manpage:`execve(2)` a file which is being opened by another +* process for writing fails with ETXTBSY. +* +* NOTE: write to executed file was allowed in 6.11-rc1: +* 2a010c412853 ("fs: don't block i_writecount during exec") +* but then reverted in v6.13-rc1: +* 3b832035387f ("Revert "fs: don't block i_writecount during exec""), +* backported into v6.11.11 and v6.12.2. */ #define _GNU_SOURCE
@@ -62,21 +68,15 @@ static void do_child(void)exit (0 ); } -static void setup (void ) -{ -if ((tst_kvercmp (6 ,11 ,0 )) >=0 ) { -tst_brk (TCONF ,"Skipping test, write to executed file is " -"allowed since 6.11-rc1.\n" -"2a010c412853 (\"fs: don't block i_writecount during exec\")" ); - } -} -static struct tst_test test = { - .setup = setup, .test_all = verify_execve, .forks_child =1 , .child_needs_reinit =1 , .needs_checkpoints =1 , + .tags = (const struct tst_tag []) { + {"linux-git" ,"3b832035387ff508fdcf0fba66701afc78f79e3d" }, + {} + }, .resource_files = (const char *const []) {TEST_APP ,NULL
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 5/9 fanotify20: Skip on v7.2
In reply to Petr Vorelfanotify_init() used to reject FAN_REPORT_PIDFD combined with FAN_REPORT_TID with EINVAL. Since Linux v7.2, fanotify supports reporting pidfds for thread IDs, so this combination is expected to succeed.
The test that these flag combinations are allowed:
FLAGS_DESC(FAN_REPORT_PIDFD | FAN_REPORT_TID), FLAGS_DESC(FAN_REPORT_PIDFD | FAN_REPORT_FID |
FAN_REPORT_DFID_NAME),
Because the above flag combinations are already "tested" by the tests that use them and we don't have any tests that >= 5.10 has support for FAN_MARK_FILESYSTEM etc just simply skip the test on v7.2.
---
The same as in v3 and previous versions.
testcases/kernel/syscalls/fanotify/fanotify20.c | 4 ++++ 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/fanotify/fanotify20.c +4 -0
@@ -15,6 +15,9 @@* * NOTE: FAN_REPORT_PIDFD support was added in v5.15-rc1 in * af579beb666a ("fanotify: add pidfd support to the fanotify API"). +* +* NOTE: since v7.2, fanotify supports reporting pidfds for thread IDs => skip +* the test. */ #define _GNU_SOURCE
@@ -75,6 +78,7 @@ static void do_cleanup(void)static struct tst_test test = { .setup = do_setup, + .max_kver ="7.1" , .test = do_test, .tcnt =ARRAY_SIZE (test_cases), .cleanup = do_cleanup,
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 6/9 lib: Add basic test for .min_kver && .max_kver
In reply to Petr VorelBasic test to CI to test that test with .min_kver < .max_kver will be run.
---
New in v4.
lib/newlib_tests/.gitignore | 1 + lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/tst_min_kver_max_kver.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 lib/newlib_tests/tst_min_kver_max_kver.c
lib/newlib_tests/.gitignore +1 -0
@@ -72,3 +72,4 @@ test_brk_pass test_brk_variant test_fail_variant test_cpu_vendor +tst_min_kver_max_kver
lib/newlib_tests/runtest.sh +1 -0
@@ -26,6 +26,7 @@ tst_device tst_expiration_timer tst_filesystems01 tst_fuzzy_sync0[1-3] +tst_min_kver_max_kver tst_needs_cmds0[1-36-8] tst_res_hexd tst_safe_sscanf
lib/newlib_tests/tst_min_kver_max_kver.c new file +21 -0
@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2026 Petr Vorel <[email protected]> +*/ + +/* +* Basic test to test that test with .min_kver < .max_kver will be run. +*/ + +#include "tst_test.h" + +static void do_test (void ) +{ +tst_res (TPASS ,"Test has sufficient kernel version" ); +} + +static struct tst_test test = { + .min_kver ="4.4" , + .max_kver ="5.0" , + .test_all = do_test, +};
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 7/9 tst_kvercmp: Factor out 2 kernels integer comparison
In reply to Petr VorelFactor out 2 kernels integer comparison into tst_kver_cmp().
This will be heavily used in metaparse.c (speedup of metadata generation) in the next commit.
---
New in v4.
include/tst_kvercmp.h | 12 ++++++++++++ lib/tst_kvercmp.c | 16 +++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-)
include/tst_kvercmp.h +12 -0
@@ -7,6 +7,18 @@#ifndef TST_KVERCMP_H__ #define TST_KVERCMP_H__ +/** +* tst_kver_cmp() - Compare two kernel versions, versions passed by 3 integers. +* +* @a1: First kernel major version. +* @a2: First kernel minor version. +* @a3: First kernel patch level. +* @b1: Second kernel major version. +* @b2: Second kernel minor version. +* @b3: Second kernel patch level. +*/ +int tst_kver_cmp (int a1,int a2,int a3,int b1,int b2,int b3); +/** * tst_kvcmp() - Compare given kernel version with kernel in string. *
lib/tst_kvercmp.c +11 -5
@@ -96,17 +96,23 @@ int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3)return rc; } +int tst_kver_cmp (int a1,int a2,int a3,int b1,int b2,int b3) +{ +int aver, bver; + + aver = (a1 <<20 ) + (a2 <<10 ) + a3; + bver = (b1 <<20 ) + (b2 <<10 ) + b3; + +return aver - bver; +} +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; - -return currver - testver; +return tst_kver_cmp (a1, a2, a3, r1, r2, r3); }int tst_kvercmp (int r1,int r2,int r3)
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
RFC PATCH v4 8/9 make: Allow to add LTP library as a dependency for host
In reply to Petr VorelWill be used for metadata.c in the next commit.
---
New in v4.
include/mk/generic_leaf_target.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/mk/generic_leaf_target.inc +4 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Generic leaf rules include Makefile. -# Copyright (c) Linux Test Project, 2017-2022 +# Copyright (c) Linux Test Project, 2017-2026 # Copyright (C) 2009, Cisco Systems Inc. # Ngie Cooper, July 2009
@@ -84,6 +84,9 @@ endif $(MAKE_TARGETS): | $(MAKE_DEPS) +# Allow to host tools reuse libltp.a +$(HOST_MAKE_TARGETS): | $(MAKE_DEPS) + all: $(MAKE_TARGETS) clean:: $(CLEAN_DEPS)
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
RFC PATCH v4 9/9 metaparse: Check {min, max}_kver validity
In reply to Petr VorelCheck .max_kver and .min_kver validity. Exit generation with error when:
* .max_kver or .min_kver is invalid
* .min_kver > .max_kver
---
New in v4.
lib/tst_test.c | 2 ++ metadata/Makefile | 6 ++++-- metadata/metaparse.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-)
lib/tst_test.c +2 -0
@@ -1496,6 +1496,8 @@ static void do_setup(int argc, char *argv[])if (tst_test->max_kver)check_max_kver (tst_test->max_kver,1 ); +// TODO: Add runtime check tst_test->max_kver >= tst_test->min_kver. +if (tst_test->skip_in_lockdown &&tst_lockdown_enabled () >0 )tst_brk (TCONF ,"Kernel is locked down, skipping test" );
metadata/Makefile +4 -2
@@ -3,13 +3,15 @@ top_srcdir ?= .. -include $(top_srcdir)/include/mk/env_pre.mk -include $(top_srcdir)/include/mk/functions.mk +include $(top_srcdir)/include/mk/testcases.mk MAKE_TARGETS := ltp.json HOST_MAKE_TARGETS := metaparse metaparse-sh INSTALL_DIR = metadata +metaparse: HOST_CFLAGS += -I$(abs_srcdir)/../include -L$(abs_builddir)/../lib +metaparse: HOST_LDLIBS += -lltp + .PHONY: ltp.json ltp.json: metaparse metaparse-sh
metadata/metaparse.c +33 -0
@@ -6,6 +6,7 @@#define _GNU_SOURCE +#include <assert.h> #include <search.h> #include <stdio.h> #include <string.h>
@@ -15,6 +16,7 @@#include <errno.h> #include "data_storage.h" +#include "tst_kvercmp.h" #define INCLUDE_PATH_MAX 5#define GROUPS_TAG "@groups"
@@ -1372,6 +1374,37 @@ int main(int argc, char *argv[]) } } +/* Check max_kver >= min_kver */ +struct data_node *max_kver =data_node_hash_get (res,"max_kver" ); +struct data_node *min_kver =data_node_hash_get (res,"min_kver" ); +int a1, a2, a3, b1, b2, b3; + +if (min_kver) { +assert (min_kver->type ==DATA_STRING ); +if (tst_parse_kver (min_kver->string.val, &b1, &b2, &b3)) { +fprintf (stderr,"%s: wrong min_kver: '%s'\n" , + argv[optind], min_kver->string.val); +return 1 ; + } + } + +if (max_kver) { +assert (max_kver->type ==DATA_STRING ); +if (tst_parse_kver (max_kver->string.val, &a1, &a2, &a3)) { +fprintf (stderr,"%s: wrong max_kver: '%s'\n" , + argv[optind], max_kver->string.val); +return 1 ; + } + } + +if (min_kver && max_kver) { +if (tst_kver_cmp (a1, a2, a3, b1, b2, b3) <0 ) { +fprintf (stderr,"%s: min_kver (%s) > max_kver (%s)\n" , + argv[optind], min_kver->string.val, max_kver->string.val); +return 1 ; + } + } +/* Normalize types */ check_normalize_types (res,"" , tst_test_typemap);
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v4 9/9] [RFC] metaparse: Check {min, max}_kver validity
Hi all,
I'm sorry, this last commit breaks out-of-tree build.
...
Quoted 4 lines
+++ b/metadata/Makefile
metadata/Makefile +0
-0@@ -3,13 +3,15 @@ top_srcdir ?= ..
metadata/Makefile line 12
Quoted 10 lines
metadata/Makefile +2
-2-include $(top_srcdir)/include/mk/env_pre.mk -include $(top_srcdir)/include/mk/functions.mk +include $(top_srcdir)/include/mk/testcases.mk MAKE_TARGETS := ltp.json HOST_MAKE_TARGETS := metaparse metaparse-sh INSTALL_DIR = metadata +metaparse: HOST_CFLAGS += -I$(abs_srcdir)/../include -L$(abs_builddir)/../lib
Either this is wrong, or the change in previous commit was not enough. Investigating.
Kind regards,
Petr
Quoted 1 line
metadata/Makefile +1
-0+metaparse: HOST_LDLIBS += -lltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v4 9/9] [RFC] metaparse: Check {min, max}_kver validity
In reply to Petr VorelHi!
Quoted 67 lines
metadata/Makefile +4
-2@@ -3,13 +3,15 @@ top_srcdir ?= .. -include $(top_srcdir)/include/mk/env_pre.mk -include $(top_srcdir)/include/mk/functions.mk +include $(top_srcdir)/include/mk/testcases.mk MAKE_TARGETS := ltp.json HOST_MAKE_TARGETS := metaparse metaparse-sh INSTALL_DIR = metadata +metaparse: HOST_CFLAGS += -I$(abs_srcdir)/../include -L$(abs_builddir)/../lib +metaparse: HOST_LDLIBS += -lltp + .PHONY: ltp.json ltp.json: metaparse metaparse-shmetadata/metaparse.c +23
-0@@ -6,6 +6,7 @@#define _GNU_SOURCE +#include <assert.h> #include <search.h> #include <stdio.h> #include <string.h> @@ -15,6 +16,7 @@#include <errno.h> #include "data_storage.h" +#include "tst_kvercmp.h" #define INCLUDE_PATH_MAX 5#define GROUPS_TAG "@groups"@@ -1372,6 +1374,37 @@ int main(int argc, char *argv[]) } } +/* Check max_kver >= min_kver */ +struct data_node *max_kver =data_node_hash_get (res,"max_kver" ); +struct data_node *min_kver =data_node_hash_get (res,"min_kver" ); +int a1, a2, a3, b1, b2, b3; + +if (min_kver) { +assert (min_kver->type ==DATA_STRING ); +if (tst_parse_kver (min_kver->string.val, &b1, &b2, &b3)) { +fprintf (stderr,"%s: wrong min_kver: '%s'\n" , + argv[optind], min_kver->string.val); +return 1 ; + } + } + +if (max_kver) { +assert (max_kver->type ==DATA_STRING ); +if (tst_parse_kver (max_kver->string.val, &a1, &a2, &a3)) { +fprintf (stderr,"%s: wrong max_kver: '%s'\n" , + argv[optind], max_kver->string.val); +return 1 ; + }
metadata/metaparse.c int main(int argc, char *argv[]) · line 1407
Quoted 10 lines
metadata/metaparse.c +10
-0+ } + +if (min_kver && max_kver) { +if (tst_kver_cmp (a1, a2, a3, b1, b2, b3) <0 ) { +fprintf (stderr,"%s: min_kver (%s) > max_kver (%s)\n" , + argv[optind], min_kver->string.val, max_kver->string.val); +return 1 ; + } + } +
Andrea is working on metadata linter, that does much more than this, e.g. checks that CVE record is valid.
This looks like a check that could be added more easily there.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v4 9/9] [RFC] metaparse: Check {min, max}_kver validity
Hi Cyril,
...
Quoted 35 lines
Quoted 21 lines
metadata/metaparse.c +21
-0+/* Check max_kver >= min_kver */ +struct data_node *max_kver =data_node_hash_get (res,"max_kver" ); +struct data_node *min_kver =data_node_hash_get (res,"min_kver" ); +int a1, a2, a3, b1, b2, b3; + +if (min_kver) { +assert (min_kver->type ==DATA_STRING ); +if (tst_parse_kver (min_kver->string.val, &b1, &b2, &b3)) { +fprintf (stderr,"%s: wrong min_kver: '%s'\n" , + argv[optind], min_kver->string.val); +return 1 ; + } + } + +if (max_kver) { +assert (max_kver->type ==DATA_STRING ); +if (tst_parse_kver (max_kver->string.val, &a1, &a2, &a3)) { +fprintf (stderr,"%s: wrong max_kver: '%s'\n" , + argv[optind], max_kver->string.val); +return 1 ; + }metadata/metaparse.c int main(int argc, char *argv[]) · line 1407
Quoted 10 lines
metadata/metaparse.c +10
-0+ } + +if (min_kver && max_kver) { +if (tst_kver_cmp (a1, a2, a3, b1, b2, b3) <0 ) { +fprintf (stderr,"%s: min_kver (%s) > max_kver (%s)\n" , + argv[optind], min_kver->string.val, max_kver->string.val); +return 1 ; + } + } +Andrea is working on metadata linter, that does much more than this, e.g. checks that CVE record is valid.
Quoted 1 line
This looks like a check that could be added more easily there.
Thanks for info, sounds good. I'll remove last 3 patches (2 of them are RFC, I suppose "tst_kvercmp: Factor out 2 kernels integer comparison" could be used by Andrea in that linter).
Anyway, I consider the rest ready (agent complains are IMHO wrong), but I'll resend.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp