mirror of https://github.com/ArduPilot/ardupilot
autotest: tidy LUA scripting internal tests
This commit is contained in:
parent
1aabcbd4b9
commit
31de6fd0b5
|
@ -5083,7 +5083,9 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
|
||||||
|
|
||||||
def test_scripting_internal_test(self):
|
def test_scripting_internal_test(self):
|
||||||
self.start_subtest("Scripting internal test")
|
self.start_subtest("Scripting internal test")
|
||||||
ex = None
|
|
||||||
|
self.context_push()
|
||||||
|
|
||||||
test_scripts = ["scripting_test.lua", "math.lua", "strings.lua"]
|
test_scripts = ["scripting_test.lua", "math.lua", "strings.lua"]
|
||||||
success_text = ["Internal tests passed", "Math tests passed", "String tests passed"]
|
success_text = ["Internal tests passed", "Math tests passed", "String tests passed"]
|
||||||
|
|
||||||
|
@ -5093,29 +5095,21 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
|
||||||
if message.get_type() != 'STATUSTEXT':
|
if message.get_type() != 'STATUSTEXT':
|
||||||
return
|
return
|
||||||
messages.append(message)
|
messages.append(message)
|
||||||
self.install_message_hook(my_message_hook)
|
|
||||||
try:
|
|
||||||
self.set_parameters({
|
|
||||||
"SCR_ENABLE": 1,
|
|
||||||
"SCR_HEAP_SIZE": 1024000,
|
|
||||||
"SCR_VM_I_COUNT": 1000000,
|
|
||||||
})
|
|
||||||
|
|
||||||
for script in test_scripts:
|
self.install_message_hook_context(my_message_hook)
|
||||||
self.install_test_script(script)
|
self.set_parameters({
|
||||||
self.reboot_sitl()
|
"SCR_ENABLE": 1,
|
||||||
self.delay_sim_time(10)
|
"SCR_HEAP_SIZE": 1024000,
|
||||||
self.remove_installed_script(script)
|
"SCR_VM_I_COUNT": 1000000,
|
||||||
|
})
|
||||||
except Exception as e:
|
for script in test_scripts:
|
||||||
self.print_exception_caught(e)
|
self.install_test_script_context(script)
|
||||||
ex = e
|
|
||||||
self.reboot_sitl()
|
self.reboot_sitl()
|
||||||
|
|
||||||
self.remove_message_hook(my_message_hook)
|
self.delay_sim_time(10)
|
||||||
|
|
||||||
if ex is not None:
|
self.context_pop()
|
||||||
raise ex
|
self.reboot_sitl()
|
||||||
|
|
||||||
# check all messages to see if we got our message
|
# check all messages to see if we got our message
|
||||||
success = True
|
success = True
|
||||||
|
|
Loading…
Reference in New Issue