diff mbox series

btrfs-progs: tests/nullb fix kernel support check

Message ID fe9a6082f152726145233e31e011f71ea4719217.1683027204.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: tests/nullb fix kernel support check | expand

Commit Message

Anand Jain May 2, 2023, 11:39 a.m. UTC
I have a setup where null_blk is not a module but is built-in, so to check
if the kernel supports null_blk, use 'modinfo -n'.

Also fix a comment.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/nullb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Sterba May 2, 2023, 2:04 p.m. UTC | #1
On Tue, May 02, 2023 at 07:39:34PM +0800, Anand Jain wrote:
> I have a setup where null_blk is not a module but is built-in, so to check
> if the kernel supports null_blk, use 'modinfo -n'.
> 
> Also fix a comment.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Added to devel, thanks. I've applied the same patch to nullb.git too.
diff mbox series

Patch

diff --git a/tests/nullb b/tests/nullb
index 3fda4a2b02f4..bffa9f331333 100755
--- a/tests/nullb
+++ b/tests/nullb
@@ -8,7 +8,7 @@ 
 # - load required modules and mount configfs
 #
 # nullb create [-s size] [-z zonesize]
-# - create a new device with given sizes, allocating the first free indes, #
+# - create a new device with given sizes, allocating the first free index,
 #   device is /dev/nullb$index
 #
 # nullb ls
@@ -51,8 +51,8 @@  function _dbg() {
 }
 
 function _check_setup() {
-	if ! grep -q null_blk /proc/modules; then
-		_error "module not loaded"
+	if ! modinfo -n null_blk > /dev/null; then
+		_error "module not compiled/loaded"
 	fi
 	if ! grep -q configfs /proc/filesystems; then
 		_error "configfs not mounted"