summaryrefslogtreecommitdiff
path: root/tests/drv_module_reload
blob: bb29a64fc36a59e278f46e28902949be04b62c9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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