From b5f871ecd1887a3a3ed1acd6849a5c68894a73bf Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sun, 2 Jun 2024 14:56:22 -0500 Subject: [PATCH] autotest: add serial loopback test script Tests that data can flow both ways with one end using protocol 28 (Scripting) and the other using the serial device feature. --- Tools/autotest/rover.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Tools/autotest/rover.py b/Tools/autotest/rover.py index dba7c96157764..6dd1ff38a0acd 100644 --- a/Tools/autotest/rover.py +++ b/Tools/autotest/rover.py @@ -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() @@ -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,