Skip to content
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 <>
  • 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): def handle(self):
out_state = "failed" out_state = "failed"

if if options.west_flash is not None:
generator_cmd = "ninja" 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 != []:
else: else:
generator_cmd = "make" if
generator_cmd = "ninja"
generator_cmd = "make"

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

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

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