From 55377b424eeb536c39349015b80a83d28dd12531 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 1 Oct 2018 09:04:57 +1000 Subject: [PATCH] Tools: autotest: add extra-configure-args option to autotest.py --- Tools/autotest/autotest.py | 7 +++++++ Tools/autotest/pysim/util.py | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index 20def49395..60a5568cc7 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -307,6 +307,7 @@ def run_step(step): "debug": opts.debug, "clean": not opts.no_clean, "configure": not opts.no_configure, + "extra_configure_args": opts.waf_configure_args, } vehicle_binary = None @@ -626,6 +627,12 @@ if __name__ == "__main__": action='store_true', help='do not configure before building', dest="no_configure") + group_build.add_option("", "--waf-configure-args", + action="append", + dest="waf_configure_args", + type="string", + default=[], + help="extra arguments passed to waf in configure") group_build.add_option("-j", default=None, type='int', help='build CPUs') group_build.add_option("--no-clean", default=False, diff --git a/Tools/autotest/pysim/util.py b/Tools/autotest/pysim/util.py index 3c422f4183..7926f51567 100644 --- a/Tools/autotest/pysim/util.py +++ b/Tools/autotest/pysim/util.py @@ -5,6 +5,7 @@ import math import os import random import re +import shlex import subprocess import sys import tempfile @@ -91,12 +92,15 @@ def relwaf(): return "./modules/waf/waf-light" -def waf_configure(board, j=None, debug=False): +def waf_configure(board, j=None, debug=False, extra_args=[]): cmd_configure = [relwaf(), "configure", "--board", board] if debug: cmd_configure.append('--debug') if j is not None: cmd_configure.extend(['-j', str(j)]) + pieces = [shlex.split(x) for x in extra_args] + for piece in pieces: + cmd_configure.extend(piece) run_cmd(cmd_configure, directory=topdir(), checkfail=True) @@ -104,12 +108,12 @@ def waf_clean(): run_cmd([relwaf(), "clean"], directory=topdir(), checkfail=True) -def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, configure=True): +def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, configure=True, extra_configure_args=[]): """Build desktop SITL.""" # first configure if configure: - waf_configure(board, j=j, debug=debug) + waf_configure(board, j=j, debug=debug, extra_args=extra_configure_args) # then clean if clean: