From ad7270f6823f38060c254a673c71fb79d739035c 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 d53df91d73..9846fb85e7 100644 --- a/Tools/autotest/rover.py +++ b/Tools/autotest/rover.py @@ -5428,6 +5428,28 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm) 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 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm) 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,