Tools: allow for selection of Storage backend type at runtime

This commit is contained in:
Peter Barker 2021-06-11 12:30:39 +10:00 committed by Andrew Tridgell
parent 3292128531
commit b2a7841672
4 changed files with 29 additions and 7 deletions

View File

@ -592,9 +592,6 @@ class sitl(Board):
cfg.fatal("Failed to find SFML Audio libraries")
env.CXXFLAGS += ['-DWITH_SITL_TONEALARM']
if cfg.options.sitl_flash_storage:
env.CXXFLAGS += ['-DSTORAGE_USE_FLASH=1']
if cfg.env.DEST_OS == 'cygwin':
env.LIB += [
'winmm',

View File

@ -5677,6 +5677,27 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
target_compid=target_compid,
want_result=mavutil.mavlink.MAV_RESULT_FAILED)
def FlashStorage(self):
self.set_parameter("LOG_BITMASK", 1)
self.reboot_sitl()
self.customise_SITL_commandline([
"--set-storage-posix-enabled", "0",
"--set-storage-flash-enabled", "1",
])
if self.get_parameter("LOG_BITMASK") == 1:
raise NotAchievedException("not using flash storage?")
self.set_parameter("LOG_BITMASK", 2)
self.reboot_sitl()
self.assert_parameter_value("LOG_BITMASK", 2)
self.set_parameter("LOG_BITMASK", 3)
self.reboot_sitl()
self.assert_parameter_value("LOG_BITMASK", 3)
self.customise_SITL_commandline([])
# make sure we're back at our original value:
self.assert_parameter_value("LOG_BITMASK", 1)
def tests(self):
'''return list of all tests'''
ret = super(AutoTestRover, self).tests()
@ -5899,6 +5920,10 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
"Test end mission behavior",
self.test_end_mission_behavior),
("FlashStorage",
"Test flash storage (for parameters etc)",
self.FlashStorage),
("LogUpload",
"Upload logs",
self.log_upload),

View File

@ -320,9 +320,6 @@ def do_build(opts, frame_options):
if opts.tonealarm:
cmd_configure.append("--enable-sfml-audio")
if opts.flash_storage:
cmd_configure.append("--sitl-flash-storage")
if opts.math_check_indexes:
cmd_configure.append("--enable-math-check-indexes")
@ -671,6 +668,9 @@ def start_vehicle(binary, opts, stuff, spawns=None):
sys.exit(1)
path = ",".join(paths)
progress("Using defaults from (%s)" % (path,))
if opts.flash_storage:
cmd.append("--set-storage-flash-enabled 1")
cmd.append("--set-storage-posix-enabled 0")
if opts.add_param_file:
for file in opts.add_param_file:
if not os.path.isfile(file):

View File

@ -33,7 +33,7 @@ _waf() {
'--sitl-osd[Enable SITL OSD]' \
'--sitl-rgbled[Enable SITL RGBLed]' \
'--build-dates[Include build date in binaries]' \
'--sitl-flash-storage[Building SITL with flash storage emulation.]' \
'--sitl-flash-storage[Use flash storage emulation.]' \
'--upload[Upload applicable targets to a connected device]' \
'--board[Board name]:board:_waf_boards' \
'--target=[Target name]:target:_waf_targets' \