summaryrefslogtreecommitdiffstats
path: root/common/scripts/test_can_modules.sh
blob: d7966b42c9689df700ddb6a2275bd7f2190cd4ea (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh

if [ ! -e /sys/class/net/can1 ];then
	lava-test-case show_can_modules --result skip
	lava-test-case unload_can_raw_module --result skip
	lava-test-case unload_can_module --result skip
	lava-test-case unload_c_can_platform_module --result skip
	lava-test-case unload_c_can_module --result skipp
	lava-test-case unload_can_dev_module --result skip
	lava-test-case canconfig_can0 --result skip
	lava-test-case canconfig_can1 --result skip
	lava-test-case load_can_module --result skip
	lava-test-case load_can_raw_module --result skip
	lava-test-case load_c_can_module --result skip
	lava-test-case load_can_dev_module --result skip
	lava-test-case canconfig_can0 --result skip
	lava-test-case canconfig_can1 --result skip
        exit 0
fi
lsmod | grep can
if [ $? -eq 0 ];then
	lava-test-case show_can_modules --result pass
else
	lava-test-case show_can_modules --result fail
fi

sleep 4

rmmod can_raw
if [ $? -eq 0 ];then
	lava-test-case unload_can_raw_module --result pass
else
	lava-test-case unload_can_raw_module --result fail
fi

rmmod can
if [ $? -eq 0 ];then
	lava-test-case unload_can_module --result pass
else
	lava-test-case unload_can_module --result fail
fi

rmmod c_can_platform
if [ $? -eq 0 ];then
	lava-test-case unload_c_can_platform_module --result pass
else
	lava-test-case unload_c_can_platform_module --result fail
fi

rmmod c_can
if [ $? -eq 0 ];then
	lava-test-case unload_c_can_module --result pass
else
	lava-test-case unload_c_can_module --result fail
fi

rmmod can_dev
if [ $? -eq 0 ];then
	lava-test-case unload_can_dev_module --result pass
else
	lava-test-case unload_can_dev_module --result fail
fi

sleep 5

canconfig can0 bitrate 50000
if [ $? -eq 0 ];then
	lava-test-case canconfig_can0 --result fail
else
	lava-test-case canconfig_can0 --result pass
fi

sleep 3

canconfig can1 bitrate 50000
if [ $? -eq 0 ];then
	lava-test-case canconfig_can1 --result fail
else
	lava-test-case canconfig_can1 --result pass
fi

sleep 5

modprobe can
if [ $? -eq 0 ];then
	lava-test-case load_can_module --result pass
else
	lava-test-case load_can_module --result fail
fi

modprobe can_raw
x=$?
sleep 5
if [ $x -eq 0 ];then
	lava-test-case load_can_raw_module --result pass
else
	lava-test-case load_can_raw_module --result fail
fi
sleep 3

modprobe c_can
if [ $? -eq 0 ];then
	lava-test-case load_c_can_module --result pass
else
	lava-test-case load_c_can_module --result fail
fi

modprobe c_can_platform
if [ $? -eq 0 ];then
	lava-test-case load_c_can_platform_module --result pass
else
	lava-test-case load_c_can_platform_module --result fail
fi

modprobe can_dev
if [ $? -eq 0 ];then
	lava-test-case load_can_dev_module --result pass
else
	lava-test-case load_can_dev_module --result fail
fi

sleep 5

canconfig can0 bitrate 50000
if [ $? -eq 0 ];then
	lava-test-case canconfig_can0 --result pass
else
	lava-test-case canconfig_can0 --result fail
fi

sleep 3
canconfig can1 bitrate 50000
if [ $? -eq 0 ];then
	lava-test-case canconfig_can1 --result pass
else
	lava-test-case canconfig_can1 --result fail
fi

sleep 3