Skip to content

Commit

Permalink
autotest: add serial loopback test script
Browse files Browse the repository at this point in the history
Tests that data can flow both ways with one end using protocol 28
(Scripting) and the other using the serial device feature.
  • Loading branch information
tpwrules committed Jun 23, 2024
1 parent 8b85a9e commit b5f871e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -5428,6 +5428,28 @@ def test_scripting_set_home_to_vehicle_location(self):
self.context_pop()
self.reboot_sitl()

def test_scripting_serial_loopback(self):
self.start_subtest("Scripting serial loopback test")

self.context_push()
self.context_collect('STATUSTEXT')
self.set_parameters({
"SCR_ENABLE": 1,
"SCR_SDEV_EN": 1,
"SCR_SDEV1_PROTO": 28,
})
self.install_test_script_context("serial_loopback.lua")
self.reboot_sitl()

for success_text in [
"driver -> device good",
"device -> driver good",
]:
self.wait_statustext(success_text, check_context=True)

self.context_pop()
self.reboot_sitl()

def Scripting(self):
'''Scripting test'''
self.test_scripting_set_home_to_vehicle_location()
Expand All @@ -5436,6 +5458,7 @@ def Scripting(self):
self.test_scripting_simple_loop()
self.test_scripting_internal_test()
self.test_scripting_auxfunc()
self.test_scripting_serial_loopback()

def test_mission_frame(self, frame, target_system=1, target_component=1):
self.clear_mission(mavutil.mavlink.MAV_MISSION_TYPE_MISSION,
Expand Down

0 comments on commit b5f871e

Please sign in to comment.