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"
113 ip link set can0 down
114 ip link set can1 down
118 if [ $found_bitrate_for_transmisson -eq 0 ];then
119 lava-test-case Receive_can1 --result fail --measurement $b --units bit/s
121 echo "There is no bitrate in this interval to provide frames transmission"
125 #This is the third part of the test, it tests the last bitrate to provide frames transmission
127 ip link set can0 down
128 ip link set can1 down
129 bitrate_no_transmission=0
130 for b in `seq 1909088 1909092`;do
131 ip link set can0 type can bitrate $b
132 ip link set can1 type can bitrate $b
138 candump can1 > $file_can &
140 size=$(stat -c %s $file_can)
141 if [ $size -eq 0 ];then
142 bitrate_no_transmission=1
143 lava-test-case Receive_can1 --result pass --measurement $(($b-1)) --units bit/s
144 lava-test-case Receive_can1 --result fail --measurement $b --units bit/s
146 echo "This bitrate $b doesn't provide frames transmission"
147 echo "The last bitrate to provide frames transmission is $(($b-1))"
150 ip link set can0 down
151 ip link set can1 down
155 if [ $bitrate_no_transmission -eq 0 ];then
156 lava-test-case Receive_can1 --result pass --measurement $b --units bit/s
157 echo "All bitrates in this interval provide frames transmission"
158 ip link set can0 down
159 ip link set can1 down
162 #This is the last part of the test, it tests the last bitrate that belongs to the domain
164 ip link set can0 down
165 ip link set can1 down
167 for b in `seq 5290999 5291000`;do
168 ip link set can0 type can bitrate $b
173 lava-test-case can0_bitrate --result fail --measurement $b --units bit/s
174 echo "$b is the first bitrate to be out of the domain"
175 echo "The last bitrate to belong to the domain is $(($b-1))"
180 if [ $out_of_domain -eq 0 ];then
181 lava-test-case can0_bitrate --result pass --measurement $b --units bit/s
182 echo "All bitrates in this interval belong to the domain"