Tools: add --enable-dronecan-tests option to autotest

This commit is contained in:
bugobliterator 2023-01-22 18:32:44 +11:00 committed by Andrew Tridgell
parent 44e897cf2d
commit 50a760d8a5
3 changed files with 21 additions and 3 deletions

View File

@ -448,6 +448,7 @@ def run_step(step):
"ubsan" : opts.ubsan, "ubsan" : opts.ubsan,
"ubsan_abort" : opts.ubsan_abort, "ubsan_abort" : opts.ubsan_abort,
"num_aux_imus" : opts.num_aux_imus, "num_aux_imus" : opts.num_aux_imus,
"dronecan_tests" : opts.dronecan_tests,
} }
if opts.Werror: if opts.Werror:
@ -978,6 +979,11 @@ if __name__ == "__main__":
default=0, default=0,
type='int', type='int',
help='number of auxiliary IMUs to simulate') help='number of auxiliary IMUs to simulate')
group_build.add_option("--enable-dronecan-tests",
default=False,
action='store_true',
dest="dronecan_tests",
help="enable dronecan tests")
parser.add_option_group(group_build) parser.add_option_group(group_build)
group_sim = optparse.OptionGroup(parser, "Simulation options") group_sim = optparse.OptionGroup(parser, "Simulation options")

View File

@ -1498,6 +1498,7 @@ class AutoTest(ABC):
ubsan=False, ubsan=False,
ubsan_abort=False, ubsan_abort=False,
num_aux_imus=0, num_aux_imus=0,
dronecan_tests=False,
build_opts={}): build_opts={}):
self.start_time = time.time() self.start_time = time.time()
@ -1578,6 +1579,7 @@ class AutoTest(ABC):
offline=self.terrain_in_offline_mode offline=self.terrain_in_offline_mode
) )
self.terrain_data_messages_sent = 0 # count of messages back self.terrain_data_messages_sent = 0 # count of messages back
self.dronecan_tests = dronecan_tests
def __del__(self): def __del__(self):
if self.rc_thread is not None: if self.rc_thread is not None:

View File

@ -118,6 +118,7 @@ def waf_configure(board,
ubsan=False, ubsan=False,
ubsan_abort=False, ubsan_abort=False,
num_aux_imus=0, num_aux_imus=0,
dronecan_tests=False,
extra_defines={}): extra_defines={}):
cmd_configure = [relwaf(), "configure", "--board", board] cmd_configure = [relwaf(), "configure", "--board", board]
if debug: if debug:
@ -138,6 +139,8 @@ def waf_configure(board,
cmd_configure.append('--ubsan-abort') cmd_configure.append('--ubsan-abort')
if num_aux_imus > 0: if num_aux_imus > 0:
cmd_configure.append('--num-aux-imus=%u' % num_aux_imus) cmd_configure.append('--num-aux-imus=%u' % num_aux_imus)
if dronecan_tests:
cmd_configure.append('--enable-dronecan-tests')
if extra_hwdef is not None: if extra_hwdef is not None:
cmd_configure.extend(['--extra-hwdef', extra_hwdef]) cmd_configure.extend(['--extra-hwdef', extra_hwdef])
for nv in extra_defines.items(): for nv in extra_defines.items():
@ -178,6 +181,7 @@ def build_SITL(
ubsan=False, ubsan=False,
ubsan_abort=False, ubsan_abort=False,
num_aux_imus=0, num_aux_imus=0,
dronecan_tests=False,
): ):
# first configure # first configure
@ -194,6 +198,7 @@ def build_SITL(
ubsan_abort=ubsan_abort, ubsan_abort=ubsan_abort,
extra_defines=extra_defines, extra_defines=extra_defines,
num_aux_imus=num_aux_imus, num_aux_imus=num_aux_imus,
dronecan_tests=dronecan_tests,
extra_args=extra_configure_args,) extra_args=extra_configure_args,)
# then clean # then clean
@ -209,7 +214,8 @@ def build_SITL(
def build_examples(board, j=None, debug=False, clean=False, configure=True, math_check_indexes=False, coverage=False, def build_examples(board, j=None, debug=False, clean=False, configure=True, math_check_indexes=False, coverage=False,
ekf_single=False, postype_single=False, force_32bit=False, ubsan=False, ubsan_abort=False, num_aux_imus=0, ekf_single=False, postype_single=False, force_32bit=False, ubsan=False, ubsan_abort=False,
num_aux_imus=0, dronecan_tests=False,
extra_configure_args=[]): extra_configure_args=[]):
# first configure # first configure
if configure: if configure:
@ -223,7 +229,8 @@ def build_examples(board, j=None, debug=False, clean=False, configure=True, math
force_32bit=force_32bit, force_32bit=force_32bit,
ubsan=ubsan, ubsan=ubsan,
ubsan_abort=ubsan_abort, ubsan_abort=ubsan_abort,
extra_args=extra_configure_args) extra_args=extra_configure_args,
dronecan_tests=dronecan_tests)
# then clean # then clean
if clean: if clean:
@ -262,6 +269,7 @@ def build_tests(board,
ubsan=False, ubsan=False,
ubsan_abort=False, ubsan_abort=False,
num_aux_imus=0, num_aux_imus=0,
dronecan_tests=False,
extra_configure_args=[]): extra_configure_args=[]):
# first configure # first configure
@ -276,7 +284,9 @@ def build_tests(board,
force_32bit=force_32bit, force_32bit=force_32bit,
ubsan=ubsan, ubsan=ubsan,
ubsan_abort=ubsan_abort, ubsan_abort=ubsan_abort,
extra_args=extra_configure_args) num_aux_imus=num_aux_imus,
dronecan_tests=dronecan_tests,
extra_args=extra_configure_args,)
# then clean # then clean
if clean: if clean: