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

Signed-off-by: Jani Nikula <[email protected]>
---
 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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to