[PATCH blktests 1/2] common/rc: add _have_kernel_options helper function
Chaitanya Kulkarni
ckulkarnilinux at gmail.com
Sat Nov 8 02:00:33 PST 2025
Add a new helper function _have_kernel_options() that accepts multiple
kernel config options as arguments. This allows tests to check for
multiple kernel options in a single call, making the requires()
function more concise.
Example usage:
requires() {
_have_kernel_options IO_URING BLK_DEV_INTEGRITY
}
Instead of:
requires() {
_have_kernel_option IO_URING
_have_kernel_option BLK_DEV_INTEGRITY
}
The function iterates through all provided options and returns failure
if any option is not enabled, maintaining the same error reporting
behavior as individual calls.
Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux at gmail.com>
---
common/rc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/common/rc b/common/rc
index 86bb991..545da61 100644
--- a/common/rc
+++ b/common/rc
@@ -226,6 +226,12 @@ _have_kernel_option() {
return 0
}
+_have_kernel_options() {
+ for opt in "$@"; do
+ _have_kernel_option "$opt" || return 1
+ done
+}
+
# Compare the version string in $1 in "a.b.c" format with "$2.$3.$4".
# If "a.b.c" is smaller than "$2.$3.$4", return true. Otherwise, return
# false.
--
2.40.0
More information about the Linux-nvme
mailing list