3 #This test is writen taking the DRA7xx-EVM board as an example
4 #Theorical values of bitrate is from 1Kbit/s to 1Mbit/s
5 #Real values to provide transmission are between 10797 bit/s and 1909090git bit/s
6 #Real values that doesn't provide transmission but belong to the domain are between 781 bit/s and 5209999 bit/s
8 if [ ! -e /sys/class/net/can1 ];then
9 lava-test-case canconfig_can0_bitrate --result skip
10 lava-test-case receive_frames_through_can1 --result skip
11 lava-test-case receive_frames_through_can1 --result skip
12 lava-test-case receive_frames_through_can1 --result skip
13 lava-test-case canconfig_can0_bitrate --result skip
14 lava-test-case receive_frames_through_can1 --result skip
18 #This is the first part of the test, that tests if the bitrate inserted belongs to the domain and if
19 #this first bitrate afford frames transmission or not
22 lava-test-case stop_can0 --result pass
24 lava-test-case stop_can0 --result fail
29 lava-test-case stop_can1 --result pass
31 lava-test-case stop_can1 --result fail
38 for b in `seq 778 790`;do
39 ip link set can0 type can bitrate $b
42 lava-test-case can0_bitrate --result pass --measurement $b --units bit/s
43 echo "$b is the first bitrate in the domain"
45 ip link set can1 type can bitrate $b
47 lava-test-case can1_bitrate --result pass --measurement $b --units bit/s
49 lava-test-case can1_bitrate --result fail --measurement $b --units bit/s
54 lava-test-case start_can0 --result pass
56 lava-test-case start_can0 --result fail
61 lava-test-case start_can1 --result pass
63 lava-test-case start_can1 --result fail
68 candump can1 > $file_can &
70 if [ -s $file_can ];then
71 lava-test-case Receive_can1 --result pass --measurement $b --units bit/s
73 lava-test-case Receive_can1 --result fail --measurement $b --units bit/s
75 echo "This bitrate $b belongs to the domain but doesn't provide frames transmission"
82 if [ $found_bitrate -eq 0 ];then
83 lava-test-case can0_bitrate --result fail --measurement $b --units bit/s
85 echo "There is no supportable bitrate in this interval"
90 #This is the second part of the test, it tests the first bitrate to provide frames transmission
94 found_bitrate_for_transmisson=0
95 for b in `seq 10790 10800`;do
96 ip link set can0 type can bitrate $b
97 ip link set can1 type can bitrate $b
103 candump can1 > $file_can &
105 if [ -s $file_can ];then
106 found_bitrate_for_transmisson=1
107 lava-test-case Receive_can1 --result pass --measurement $b --units bit/s
109 echo "$b is the first supportable bitrate to provide transmission"
112 ip link set can0 down
113 ip link set can1 down
117 if [ $found_bitrate_for_transmisson -eq 0 ];then
118 lava-test-case Receive_can1 --result fail --measurement $b --units bit/s
120 echo "There is no bitrate in this interval to provide frames transmission"
124 #This is the third part of the test, it tests the last bitrate to provide frames transmission
126 ip link set can0 down
127 ip link set can1 down
128 bitrate_no_transmission=0
129 for b in `seq 1909088 1909092`;do
130 ip link set can0 type can bitrate $b
131 ip link set can1 type can bitrate $b
137 candump can1 > $file_can &
139 size=$(stat -c %s $file_can)
140 if [ $size -eq 0 ];then
141 bitrate_no_transmission=1
142 lava-test-case Receive_can1 --result pass --measurement $(($b-1)) --units bit/s
143 lava-test-case Receive_can1 --result fail --measurement $b --units bit/s
145 echo "This bitrate $b doesn't provide frames transmission"
146 echo "The last bitrate to provide frames transmission is $(($b-1))"
149 ip link set can0 down
150 ip link set can1 down
154 if [ $bitrate_no_transmission -eq 0 ];then
155 lava-test-case Receive_can1 --result pass --measurement $b --units bit/s
156 echo "All bitrates in this interval provide frames transmission"
157 ip link set can0 down
158 ip link set can1 down
161 #This is the last part of the test, it tests the last bitrate that belongs to the domain
163 ip link set can0 down
164 ip link set can1 down
166 for b in `seq 5290999 5291000`;do
167 ip link set can0 type can bitrate $b
172 lava-test-case can0_bitrate --result fail --measurement $b --units bit/s
173 echo "$b is the first bitrate to be out of the domain"
174 echo "The last bitrate to belong to the domain is $(($b-1))"
179 if [ $out_of_domain -eq 0 ];then
180 lava-test-case can0_bitrate --result pass --measurement $b --units bit/s
181 echo "All bitrates in this interval belong to the domain"