mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 16:36:14 +00:00
Recent refactoring has made absence of snd-hda-intel a test failure do the respective modprobe being at the end of a reload function now. Only fail in this case if module was previously unloaded. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
86 lines
1.9 KiB
Bash
Executable File
86 lines
1.9 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() {
|
|
local snd_hda_intel_unloaded
|
|
|
|
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
|
|
snd_hda_intel_unloaded=0
|
|
rmmod snd_hda_intel &> /dev/null && snd_hda_intel_unloaded=1
|
|
|
|
#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 -q snd_hda_intel || return $snd_hda_intel_unloaded
|
|
}
|
|
|
|
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
|
|
for i in $(seq 1 4); do
|
|
reload inject_load_failure=$i
|
|
done
|
|
|
|
reload || exit $?
|
|
finish_load
|
|
|
|
exit $?
|