Files
panda-meb/tests/automated/4_wifi_functionality.py
Nigel Armstrong 1d2f8f0abf Jenkins (#179)
* Improve panda automated testing

 * begin testing both white and grey panda
 * Improve wifi reliability

* First commit for docker

* Fix usb devices not showing up on reconnect

* Add tests for two pandas, latency and throughput

* Add Jenkinsfile

* Allow flashing release on wifi

* Fix Jenkins stuck in DFU mode and docker container running

* Add pandaextra from xx to docker

* Need more time for ST to restart, sometimes

* Add xml output to tests

* Try making wifi more reliable

* Fix infinite loop in ping

* Check connected after flash

* Cleanup two panda tests

* Try fixing failing test with check after udp

* Try to fix with sleep

* Temporarily run just 5 and 6

* Cleanup

* Desperate times call for desperate measurse

* BUGFIX: power saving when rx only

* Fix failing when white panda is first after udp

* Test both Dev and EON build

* Jenkins test results for both builds

* Better test case naming
2019-04-09 14:09:18 -07:00

60 lines
1.7 KiB
Python

from __future__ import print_function
import time
from panda import Panda
from helpers import time_many_sends, connect_wifi, test_white, panda_color_to_serial
from nose.tools import timed, assert_equal, assert_less, assert_greater
@test_white
@panda_color_to_serial
def test_get_serial_wifi(serial=None):
connect_wifi(serial)
p = Panda("WIFI")
print(p.get_serial())
@test_white
@panda_color_to_serial
def test_throughput(serial=None):
connect_wifi(serial)
p = Panda(serial)
# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)
# enable CAN loopback mode
p.set_can_loopback(True)
p = Panda("WIFI")
for speed in [100,250,500,750,1000]:
# set bus 0 speed to speed
p.set_can_speed_kbps(0, speed)
time.sleep(0.1)
comp_kbps = time_many_sends(p, 0)
# bit count from https://en.wikipedia.org/wiki/CAN_bus
saturation_pct = (comp_kbps/speed) * 100.0
#assert_greater(saturation_pct, 80)
#assert_less(saturation_pct, 100)
print("WIFI loopback 100 messages at speed %d, comp speed is %.2f, percent %.2f" % (speed, comp_kbps, saturation_pct))
@test_white
@panda_color_to_serial
def test_recv_only(serial=None):
connect_wifi(serial)
p = Panda(serial)
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)
p.set_can_loopback(True)
pwifi = Panda("WIFI")
# TODO: msg_count=1000 drops packets, is this fixable?
for msg_count in [10,100,200]:
speed = 500
p.set_can_speed_kbps(0, speed)
comp_kbps = time_many_sends(p, 0, pwifi, msg_count)
saturation_pct = (comp_kbps/speed) * 100.0
print("HT WIFI loopback %d messages at speed %d, comp speed is %.2f, percent %.2f" % (msg_count, speed, comp_kbps, saturation_pct))