autotest: add tests to a pair of lua scripts

This commit is contained in:
Peter Barker 2022-02-18 17:47:13 +11:00 committed by Peter Barker
parent 9229fb6f9d
commit 001a06d17d

View File

@ -5125,7 +5125,61 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
if ex is not None:
raise ex
def test_scripting_print_home_and_origin(self):
self.start_subtest("Scripting print home and origin")
self.context_push()
ex = None
example_script = "ahrs-print-home-and-origin.lua"
try:
self.set_parameter("SCR_ENABLE", 1)
self.install_example_script(example_script)
self.reboot_sitl()
self.wait_ready_to_arm()
self.wait_statustext("Home - ")
self.wait_statustext("Origin - ")
except Exception as e:
self.print_exception_caught(e)
ex = e
self.remove_example_script(example_script)
self.context_pop()
self.reboot_sitl()
if ex is not None:
raise ex
def test_scripting_set_home_to_vehicle_location(self):
self.start_subtest("Scripting set home to vehicle location")
self.context_push()
ex = None
example_script = "ahrs-set-home-to-vehicle-location.lua"
try:
self.set_parameter("SCR_ENABLE", 1)
self.install_example_script(example_script)
self.reboot_sitl()
self.wait_statustext("Home position reset")
except Exception as e:
self.print_exception_caught(e)
ex = e
self.remove_example_script(example_script)
self.context_pop()
self.reboot_sitl()
if ex is not None:
raise ex
def test_scripting(self):
self.test_scripting_set_home_to_vehicle_location()
self.test_scripting_print_home_and_origin()
self.test_scripting_hello_world()
self.test_scripting_simple_loop()
self.test_scripting_internal_test()