From 1291c93aeacfa3c8e3253c12c1248672af59e02b Mon Sep 17 00:00:00 2001 From: Justin M. Forbes Date: Jan 20 2013 17:22:24 +0000 Subject: Add module check utility --- diff --git a/utils/mod-check.sh b/utils/mod-check.sh index 727569f..f706ee0 100644 --- a/utils/mod-check.sh +++ b/utils/mod-check.sh @@ -1,5 +1,20 @@ #!/bin/bash +# This function will check to see if a module is loaded. It is usefule +# for tests which require specific modules or hardware. If a module +# is not loaded, the result should typically be a skip, not a failure. +# Example usage in your runtest.sh: +# +# source ../../utils/mod-check.sh +# module=foobar +# check_mod +# has_mod=$? +# +# if [ "$has_mod" -ne "0" ]; then +# exit 3 +# fi + + check_mod() { if [ $(lsmod | grep -wc $module ) -eq 0 ] then