Tools: test_build_options.py: test disabling all options

This commit is contained in:
Peter Barker 2022-01-14 12:18:45 +11:00 committed by Andrew Tridgell
parent a6099acd5c
commit 0af97b5bdb

View File

@ -54,6 +54,10 @@ def get_defines(feature, options):
def test_feature(feature, options): def test_feature(feature, options):
defines = get_defines(feature, options) defines = get_defines(feature, options)
test_compile_with_defines(defines)
def test_compile_with_defines(defines):
extra_hwdef_filepath = "/tmp/extra.hwdef" extra_hwdef_filepath = "/tmp/extra.hwdef"
write_defines_to_file(defines, extra_hwdef_filepath) write_defines_to_file(defines, extra_hwdef_filepath)
util.waf_configure( util.waf_configure(
@ -64,12 +68,12 @@ def test_feature(feature, options):
try: try:
util.waf_build(t) util.waf_build(t)
except Exception: except Exception:
print("Failed to build (%s) with (%s) disabled" % print("Failed to build (%s) with everything disabled" %
(t, feature.label)) (t,))
raise raise
def run(): def run_disable_in_turn():
options = get_build_options_from_ardupilot_tree() options = get_build_options_from_ardupilot_tree()
count = 1 count = 1
for feature in options: for feature in options:
@ -79,5 +83,18 @@ def run():
count += 1 count += 1
def run_disable_all():
options = get_build_options_from_ardupilot_tree()
defines = {}
for feature in options:
defines[feature.define] = 0
test_compile_with_defines(defines)
def run():
run_disable_all()
run_disable_in_turn()
if __name__ == '__main__': if __name__ == '__main__':
run() run()