ntel-gpu-tools/tests/drv_module_reload_basic
Imre Deak f0d5874bd8 drv_module_reload_basic: skip alive check after load failure injection
After loading the module with load failure injection enabled don't try
check the alive state. Also limit the number of failure points to
existing ones, to reduce the run time of the test.

v2:
- make VT binding/snd module loading part of reload and VT bind fail
  silently (Chris)

Signed-off-by: Imre Deak <imre.deak@intel.com>
2016-03-14 17:44:55 +02:00

85 lines
1.8 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
function reload() {
echo Reloading i915.ko with $*
# 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 || return $IGT_EXIT_SKIP
#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!
return $IGT_EXIT_FAILURE
else
echo module successfully unloaded
fi
modprobe i915 $*
if [ -f /sys/class/vtconsole/vtcon1/bind ]; then
echo 1 > /sys/class/vtconsole/vtcon1/bind
fi
modprobe snd_hda_intel
}
function finish_load() {
# does the device exist?
if $SOURCE_DIR/gem_alive > /dev/null ; then
echo "module successfully loaded again"
else
echo "failed to reload module successfully"
return $IGT_EXIT_FAILURE
fi
# then try to run something
if ! $SOURCE_DIR/gem_exec_store > /dev/null ; then
echo "failed to execute a simple batch after reload"
return $IGT_EXIT_FAILURE
fi
return $IGT_EXIT_SUCCESS
}
reload || exit $?
finish_load || exit $?
# Repeat the module reload trying to to generate faults
fault=1
for i in $(seq 0 4); do
reload inject_load_failure=$fault
fault=$(($fault * 2))
done
reload || exit $?
finish_load
exit $?