Skip to content
Permalink
Browse files

sanitycheck: Allow custom arguments for west-flash

This allows you to use west to flash the device and pass custom
arguments to the flash command.

Signed-off-by: Andy Doan <andy@foundries.io>
  • Loading branch information...
doanac authored and galak committed Feb 8, 2019
1 parent b3674f5 commit 79c48849fe65291cb973d32bdc75d46278e10a36
Showing with 28 additions and 4 deletions.
  1. +28 −4 scripts/sanitycheck
@@ -667,12 +667,23 @@ class DeviceHandler(Handler):
def handle(self):
out_state = "failed"

if options.ninja:
generator_cmd = "ninja"
if options.west_flash is not None:
command = ["west", "flash", "--skip-rebuild", "-d", self.outdir]
# There are two ways this option is used.
# 1) bare: --west-flash
# This results in options.west_flash == []
# 2) with a value: --west-flash="--board-id=42"
# This results in options.west_flash == "--board-id=42"
if options.west_flash != []:
command.append('--')
command.append(options.west_flash)
else:
generator_cmd = "make"
if options.ninja:
generator_cmd = "ninja"
else:
generator_cmd = "make"

command = [generator_cmd, "-C", self.outdir, "flash"]
command = [generator_cmd, "-C", self.outdir, "flash"]

device = options.device_serial
ser = serial.Serial(
@@ -696,6 +707,7 @@ class DeviceHandler(Handler):
args=(ser, rpipe, harness))
t.start()

logging.debug('Flash command: %s', command)
try:
if VERBOSE:
subprocess.check_call(command)
@@ -2945,6 +2957,18 @@ Artificially long but functional example:
which will ultimately disable ccache.
"""
)
parser.add_argument(
"--west-flash", nargs='?', const=[],
help="""Uses west instead of ninja or make to flash when running with
--device-testing"
E.g
sanitycheck --device-testing --device-serial /dev/ttyACM0 \
--west-flash="--board-id=foobar"
will translate to
west flash -- --board-id=foobar
"""
)
parser.add_argument("--gcov-tool", default="gcov",
help="Path to the gcov tool. Default is gcov in the path.")

0 comments on commit 79c4884

Please sign in to comment.
You can’t perform that action at this time.