ntel-gpu-tools/tests/drv_module_reload
Chris Wilson a29f28eba9 igt/drv_module_reload: Check more carefully for a live driver
As drm_open_any() now quietly fails if there is no driver, this
nullifies the effectiviness of using gem_exec_nop as the test for a good
reload. Combine with gem_alive (and guarantee that gem_alive can detect
a dead driver, putting lie to

commit 032f30cb38bb03562ee7fde19cd278b1d8ac31a9
Author: Thomas Wood <thomas.wood@intel.com>
Date:   Tue Jan 13 13:33:57 2015 +0000

    lib: remove unnecessary checks on the drm_open_any return value

) first.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88573
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-19 09:47:03 +00:00

61 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#
# Testcase: Reload the drm module
#
# ... we've broken this way too often :(
#
SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
. $SOURCE_DIR/drm_lib.sh
# no other drm service should be running, so we can just unbind
# we must kick away fbcon (but only fbcon)
for vtcon in /sys/class/vtconsole/vtcon*/ ; do
if grep "frame buffer device" $vtcon/name > /dev/null ; then
echo unbinding $vtcon: `cat $vtcon/name`
echo 0 > $vtcon/bind
fi
done
# The sound driver uses our power well
pkill alsactl
rmmod snd_hda_intel &> /dev/null
#ignore errors in ips - gen5 only
rmmod intel_ips &> /dev/null
rmmod i915
#ignore errors in intel-gtt, often built-in
rmmod intel-gtt &> /dev/null
# drm may be used by other devices (nouveau, radeon, udl, etc)
rmmod drm_kms_helper &> /dev/null
rmmod drm &> /dev/null
if lsmod | grep i915 &> /dev/null ; then
echo WARNING: i915.ko still loaded!
exit 1
else
echo module successfully unloaded
fi
modprobe i915
echo 1 > /sys/class/vtconsole/vtcon1/bind
modprobe snd_hda_intel
# does the device exist?
if $SOURCE_DIR/gem_alive > /dev/null ; then
echo "module successfully loaded again"
else
echo "failed to reload module successfully"
exit 2
fi
# then try to run something
if ! $SOURCE_DIR/gem_exec_nop > /dev/null ; then
echo "failed to execute a simple batch after reload"
exit 3
fi
exit 0