runners: enforce RunnerCaps via create() indirection

Require all implementations to provide a do_create(), a new
ZephyrBinaryRunner abstract class method, and make create() itself
concrete.

This allows us to enforce common conventions related to individual
runner capabilities as each runner provides to the core via
RunnerCaps.

For now, just enforce that:

- common options related to capabilities are always added, so runners
  can't reuse them for different ends

- common options provided for runners which don't support them emit
  sensible error messages that should be easy to diagnose and support

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-06-23 13:35:52 -07:00 committed by Carles Cufí
commit f8e8e9229d
21 changed files with 52 additions and 24 deletions

View file

@ -63,7 +63,7 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
help='Partition table to flash')
@classmethod
def create(cls, cfg, args):
def do_create(cls, cfg, args):
if args.esp_tool:
espidf = args.esp_tool
else: