[LTP] [PATCH v5 7/7] lib: Add 2 basic tests for .min_kver && .max_kver
Petr Vorel
pvorel@suse.cz
Mon Aug 10 18:00:48 CEST 2026
* tst_max_kver_old.c
Basic test to test .max_kver detection works. Test should TCONF due
running on newer kernel.
* tst_min_kver_max_kver.c
Basic test to test that .min_kver and .max_kver can be used together.
Test should TCONF or TPASS.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v4->v5:
* Add one more test, increase max_kver in the test added previous
version.
lib/newlib_tests/.gitignore | 2 ++
lib/newlib_tests/runtest.sh | 2 ++
lib/newlib_tests/tst_max_kver_old.c | 21 +++++++++++++++++++++
lib/newlib_tests/tst_min_kver_max_kver.c | 22 ++++++++++++++++++++++
4 files changed, 47 insertions(+)
create mode 100644 lib/newlib_tests/tst_max_kver_old.c
create mode 100644 lib/newlib_tests/tst_min_kver_max_kver.c
diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
index b851638246..d55e38bb29 100644
--- a/lib/newlib_tests/.gitignore
+++ b/lib/newlib_tests/.gitignore
@@ -72,3 +72,5 @@ test_brk_pass
test_brk_variant
test_fail_variant
test_cpu_vendor
+tst_max_kver_old
+tst_min_kver_max_kver
diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh
index 71808ef8b8..ad38d845a3 100755
--- a/lib/newlib_tests/runtest.sh
+++ b/lib/newlib_tests/runtest.sh
@@ -26,6 +26,8 @@ tst_device
tst_expiration_timer
tst_filesystems01
tst_fuzzy_sync0[1-3]
+tst_max_kver_old
+tst_min_kver_max_kver
tst_needs_cmds0[1-36-8]
tst_res_hexd
tst_safe_sscanf
diff --git a/lib/newlib_tests/tst_max_kver_old.c b/lib/newlib_tests/tst_max_kver_old.c
new file mode 100644
index 0000000000..3b03f555b6
--- /dev/null
+++ b/lib/newlib_tests/tst_max_kver_old.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2026 Petr Vorel <pvorel@suse.cz>
+ */
+
+/*
+ * Basic test to test .max_kver detection works.
+ * Test should TCONF due running on newer kernel.
+ */
+
+#include "tst_test.h"
+
+static void do_test(void)
+{
+ tst_res(TFAIL, "Really running on kernel 1.0?");
+}
+
+static struct tst_test test = {
+ .max_kver = "1.0",
+ .test_all = do_test,
+};
diff --git a/lib/newlib_tests/tst_min_kver_max_kver.c b/lib/newlib_tests/tst_min_kver_max_kver.c
new file mode 100644
index 0000000000..5c1b0b3a29
--- /dev/null
+++ b/lib/newlib_tests/tst_min_kver_max_kver.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2026 Petr Vorel <pvorel@suse.cz>
+ */
+
+/*
+ * Basic test to test that .min_kver and .max_kver can be used together.
+ * Test should TCONF or TPASS.
+ */
+
+#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 = "7.2",
+ .test_all = do_test,
+};
--
2.55.0
More information about the ltp
mailing list