Skip to content

Commit 1f74eb9

Browse files
ChaitanayaKulkarnikawasaki
authored andcommitted
common/rc: add _have_kernel_options helper function
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 <[email protected]> [Shin'ichiro: modified _have_kernel_options() to check all arguments] Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 9f0b5f2 commit 1f74eb9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

common/rc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ _have_kernel_option() {
237237
return 0
238238
}
239239

240+
_have_kernel_options() {
241+
local ret=0
242+
243+
for opt in "$@"; do
244+
_have_kernel_option "$opt" || ret=1
245+
done
246+
247+
return $ret
248+
}
249+
240250
# Compare the version string in $1 in "a.b.c" format with "$2.$3.$4".
241251
# If "a.b.c" is smaller than "$2.$3.$4", return true. Otherwise, return
242252
# false.

0 commit comments

Comments
 (0)