[LTP] [PATCH 1/3] doc/c-test-api.txt: Update tst_kvercmp{2, }() use
Petr Vorel
pvorel@suse.cz
Tue Jan 3 18:50:57 CET 2023
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
doc/c-test-api.txt | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/doc/c-test-api.txt b/doc/c-test-api.txt
index bc2d479452..a3ee9cab47 100644
--- a/doc/c-test-api.txt
+++ b/doc/c-test-api.txt
@@ -584,8 +584,21 @@ positive means that it's newer.
The second function 'tst_kvercmp2()' allows for specifying per-vendor table of
kernel versions as vendors typically backport fixes to their kernels and the
-test may be relevant even if the kernel version does not suggests so. See
-'testcases/kernel/syscalls/inotify/inotify04.c' for example usage.
+test may be relevant even if the kernel version does not suggests so.
+
+[source,c]
+-------------------------------------------------------------------------------
+if (tst_kvercmp(5, 19, 0) >= 0)
+ tst_res(TCONF, "Test valid only for kernel < 5.19");
+
+static struct tst_kern_exv kvers[] = {
+ { "UBUNTU", "4.4.0-48.69" },
+ { NULL, NULL},
+};
+
+if (tst_kvercmp2(4, 4, 27, kvers) < 0)
+ /* code for kernel < v4.4.27 or ubuntu kernel < 4.4.0-48.69 */
+-------------------------------------------------------------------------------
WARNING: The shell 'tst_kvercmp' maps the result into unsigned integer - the
process exit value.
--
2.39.0
More information about the ltp
mailing list