[Intel-gfx] [i-g-t PATCH 1/3] igt/drv_module_reload_basic: add helper for checking module reloaded

Jani Nikula jani.nikula at intel.com
Mon Oct 3 14:20:30 UTC 2016


Add a helper for checking whether a module is reloaded, using
lsmod. Also make the grep stricter than before.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 tests/drv_module_reload_basic | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic
index 3bba796f0306..4f3172788eca 100755
--- a/tests/drv_module_reload_basic
+++ b/tests/drv_module_reload_basic
@@ -10,6 +10,12 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 
 # no other drm service should be running, so we can just unbind
 
+# return 0 if module by name $1 is loaded according to lsmod
+function mod_loaded()
+{
+	lsmod | grep -w "^$1" &> /dev/null
+}
+
 function reload() {
 	local snd_hda_intel_unloaded
 
@@ -37,7 +43,7 @@ function reload() {
 	rmmod drm_kms_helper &> /dev/null
 	rmmod drm &> /dev/null
 
-	if lsmod | grep i915 &> /dev/null ; then
+	if mod_loaded i915; then
 		echo WARNING: i915.ko still loaded!
 		return $IGT_EXIT_FAILURE
 	else
-- 
2.1.4



More information about the Intel-gfx mailing list