Whamcloud - gitweb
LU-336 Tighten matching criteria in module_loaded
authorPrakash Surya <surya1@llnl.gov>
Thu, 21 Apr 2011 18:10:20 +0000 (11:10 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 3 Jun 2011 23:46:03 +0000 (16:46 -0700)
The function module_loaded can easily produce false positives because
of it's lenient way of grep'ing the output of lsmod. Tightening up the
criteria upon which it uses to determine if a module is loaded, reduces
the risk of returning these false positives.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Change-Id: Id8a20bf568be275eeb3ef466cb3fd051f8389b44
Reviewed-on: http://review.whamcloud.com/558
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Brian J. Murrell <brian@whamcloud.com>
lustre/tests/test-framework.sh

index e200b89..6fbddd6 100644 (file)
@@ -265,7 +265,7 @@ esac
 
 
 module_loaded () {
-   /sbin/lsmod | grep -q $1
+   /sbin/lsmod | grep -q "^\<$1\>"
 }
 
 # Load a module on the system where this is running.