diff --git a/Tools/autotest/build-with-disabled-features.py b/Tools/autotest/build-with-disabled-features.py index ddb8c58543..7ee645470d 100755 --- a/Tools/autotest/build-with-disabled-features.py +++ b/Tools/autotest/build-with-disabled-features.py @@ -28,19 +28,31 @@ pbarker@bluebottle:~/rc/ardupilot(build-with-disabled-features)$ q import re import shutil import subprocess +import sys from pysim import util class Builder(): - def __init__(self, spec): + def __init__(self, spec, autotest=False, board=None): self.config = spec["config"] - self.autotest_build = spec["builddir"] + self.autotest_build = spec["autotest_target"] + self.target_binary = spec["target_binary"] # list other features that have to be disabled when a feature # is disabled (recursion not done; be exhaustive): self.reverse_deps = spec["reverse-deps"] + self.autotest = autotest + self.board = board + + def description(self): + if self.autotest: + return self.autotest_build + if self.target_binary: + return "%s:%s" % (self.board, self.target_binary) + print("Bad config") + sys.exit(1) def reverse_deps_for_var(self, var): return self.reverse_deps.get(var, []) @@ -112,6 +124,26 @@ class Builder(): def build_works(self): self.progress("Building") + + if self.autotest: + return self.build_works_autotest() + + try: + ret = util.run_cmd(["./waf", "configure", "--board", self.board]) + except subprocess.CalledProcessError: + return False + if ret != 0: + return False + try: + ret = util.run_cmd(["./waf", "build", "--target", self.target_binary]) + except subprocess.CalledProcessError: + return False + if ret != 0: + return False + + return True + + def build_works_autotest(self): autotest = util.reltopdir("Tools/autotest/autotest.py") try: ret = util.run_cmd([autotest, self.autotest_build]) @@ -160,7 +192,8 @@ class BuilderCopter(Builder): specs = [ { "config": 'ArduCopter/config.h', - "builddir": "build.ArduCopter", + "autotest_target": "build.ArduCopter", + "target_binary": "bin/arducopter", "reverse-deps": { "AC_FENCE": ["AC_AVOID_ENABLED", "MODE_FOLLOW_ENABLED"], "PROXIMITY_ENABLED": ["AC_AVOID_ENABLED", "MODE_FOLLOW_ENABLED" ], @@ -172,19 +205,39 @@ specs = [ "MODE_GUIDED_ENABLED": ["MODE_AUTO_ENABLED", "AC_TERRAIN", "ADSB_ENABLED", "MODE_FOLLOW_ENABLED", "MODE_GUIDED_NOGPS_ENABLED"], "AC_AVOID_ENABLED": ["MODE_FOLLOW_ENABLED"], }, - }, { + }, + { + "config": 'ArduCopter/config.h', + "autotest_target": "build.Helicopter", + "target_binary": "bin/arducopter-heli", + "reverse-deps": { + "AC_FENCE": ["AC_AVOID_ENABLED", "MODE_FOLLOW_ENABLED"], + "PROXIMITY_ENABLED": ["AC_AVOID_ENABLED", "MODE_FOLLOW_ENABLED" ], + "AC_RALLY": ["AC_TERRAIN"], + "MODE_AUTO_ENABLED": ["AC_TERRAIN", "MODE_GUIDED"], + "MODE_RTL_ENABLED": ["MODE_AUTO_ENABLED", "AC_TERRAIN"], + "BEACON_ENABLED": ["AC_AVOID_ENABLED", "MODE_FOLLOW_ENABLED"], + "MODE_CIRCLE_ENABLED": ["MODE_AUTO_ENABLED", "AC_TERRAIN"], + "MODE_GUIDED_ENABLED": ["MODE_AUTO_ENABLED", "AC_TERRAIN"], + "AC_AVOID_ENABLED": ["MODE_FOLLOW_ENABLED"], + }, + }, + { "config": 'ArduPlane/config.h', - "builddir": "build.ArduPlane", + "autotest_target": "build.ArduPlane", + "target_binary": "bin/arduplane", "reverse-deps": { }, }, { "config": 'APMrover2/config.h', - "builddir": "build.APMrover2", + "autotest_target": "build.APMrover2", + "target_binary": "bin/ardurover", "reverse-deps": { }, }, { "config": 'ArduSub/config.h', - "builddir": "build.ArduSub", + "autotest_target": "build.ArduSub", + "target_binary": "bin/ardusub", "reverse-deps": { "AC_FENCE": ["AVOIDANCE_ENABLED"], "PROXIMITY_ENABLED": ["AVOIDANCE_ENABLED"], @@ -192,20 +245,31 @@ specs = [ }, }, { "config": 'AntennaTracker/config.h', - "builddir": "build.AntennaTracker", + "autotest_target": "build.AntennaTracker", + "target_binary": "bin/antennatracker", "reverse-deps": { }, - }, -] + },] + builders = [] + +# append autotest builders: for spec in specs: - builder = Builder(spec) + builder = Builder(spec, autotest=True) builder.run() builders.append(builder) +# append directly-build-by-waf targets +for spec in specs: + for board in ["CubeOrange"]: + builder = Builder(spec, board=board) + builder.run() + builders.append(builder) + + print("") for builder in builders: - print("Builder: %s" % builder.autotest_build) + print("Builder: %s" % builder.description()) print(" Successes: %s" % builder.successes) print(" Failures: %s" % builder.failures)