mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
Tools: Add a more complicated scripting test
This commit is contained in:
parent
38e17e2068
commit
88fa7eee6e
@ -4680,6 +4680,41 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
|
||||
if count < 3:
|
||||
raise NotAchievedException("Expected at least three hellos")
|
||||
|
||||
def test_scripting_internal_test(self):
|
||||
self.start_subtest("Scripting internal test")
|
||||
ex = None
|
||||
example_script = "scripting_test.lua"
|
||||
messages = []
|
||||
def my_message_hook(mav, m):
|
||||
if m.get_type() != 'STATUSTEXT':
|
||||
return
|
||||
messages.append(m)
|
||||
self.install_message_hook(my_message_hook)
|
||||
try:
|
||||
self.set_parameter("SCR_ENABLE", 1)
|
||||
self.set_parameter("SCR_HEAP_SIZE", 65536) # this is more heap then we need, but this script will keep getting bigger
|
||||
self.install_example_script(example_script)
|
||||
self.reboot_sitl()
|
||||
self.delay_sim_time(10)
|
||||
except Exception as e:
|
||||
ex = e
|
||||
self.remove_example_script(example_script)
|
||||
self.reboot_sitl()
|
||||
|
||||
self.remove_message_hook(my_message_hook)
|
||||
|
||||
if ex is not None:
|
||||
raise ex
|
||||
|
||||
# check all messages to see if we got our message
|
||||
success = False
|
||||
for m in messages:
|
||||
if "Internal tests passed" in m.text:
|
||||
success = True
|
||||
self.progress("Success")
|
||||
if not success :
|
||||
raise NotAchievedException("Scripting internal test failed")
|
||||
|
||||
def test_scripting_hello_world(self):
|
||||
self.start_subtest("Scripting hello world")
|
||||
ex = None
|
||||
|
Loading…
Reference in New Issue
Block a user