autotest: add test for AP_Logger documentation generation

This commit is contained in:
Peter Barker 2020-03-18 11:34:52 +11:00 committed by Peter Barker
parent 60ff6c0b24
commit 28c3ba32ae
1 changed files with 37 additions and 0 deletions

View File

@ -1033,6 +1033,39 @@ class AutoTest(ABC):
# if fail: # if fail:
# raise NotAchievedException("Extra parameters in XML") # raise NotAchievedException("Extra parameters in XML")
def test_onboard_logging_generation(self):
'''just generates, as we can't do a lot of testing'''
xml_filepath = os.path.join(self.rootdir(), "LogMessages.xml")
parse_filepath = os.path.join(self.rootdir(), 'Tools', 'autotest', 'logger_metadata', 'parse.py')
try:
os.unlink(xml_filepath)
except OSError:
pass
vehicle = self.log_name()
vehicle_map = {
"ArduCopter": "Copter",
"HeliCopter": "Copter",
"ArduPlane": "Plane",
"QuadPlane": "Plane",
"APMrover2": "Rover",
"AntennaTracker": "Tracker",
"ArduSub": "Sub",
}
vehicle = vehicle_map[vehicle]
cmd = [parse_filepath, '--vehicle', vehicle]
# cmd.append("--verbose")
if util.run_cmd(cmd,
directory=util.reltopdir('.')) != 0:
print("Failed parse.py (%s)" % vehicle)
return False
length = os.path.getsize(xml_filepath)
min_length = 1024
if length < min_length:
raise NotAchievedException("short xml file (%u < %u)" %
(length, min_length))
self.progress("xml file length is %u" % length)
def initialise_after_reboot_sitl(self): def initialise_after_reboot_sitl(self):
# after reboot stream-rates may be zero. Prompt MAVProxy to # after reboot stream-rates may be zero. Prompt MAVProxy to
@ -5041,6 +5074,10 @@ switch value'''
"Test Parameter Set/Get", "Test Parameter Set/Get",
self.test_parameters), self.test_parameters),
("LoggerDocumentation",
"Test Onboard Logging Generation",
self.test_onboard_logging_generation),
("GetCapabilities", ("GetCapabilities",
"Get Capabilities", "Get Capabilities",
self.test_get_autopilot_capabilities), self.test_get_autopilot_capabilities),