Skip to content

Commit

Permalink
examples/suit_update: apply blake
Browse files Browse the repository at this point in the history
  • Loading branch information
fjmolinas committed Apr 22, 2022
1 parent f4352ee commit 7dbc1c9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions examples/suit_update/tests-with-config/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def notify(coap_server, client_url, version=None):
assert not subprocess.call(cmd)


def publish(server_dir, server_url, app_ver, keys='default', latest_name=None):
def publish(server_dir, server_url, app_ver, keys="default", latest_name=None):
cmd = [
"make",
"suit/publish",
Expand All @@ -68,14 +68,15 @@ def publish(server_dir, server_url, app_ver, keys='default', latest_name=None):


def wait_for_update(child):
return child.expect([r"Fetching firmware \|[█ ]+\|\s+\d+\%",
"Finalizing payload store"],
timeout=UPDATING_TIMEOUT)
return child.expect(
[r"Fetching firmware \|[█ ]+\|\s+\d+\%", "Finalizing payload store"],
timeout=UPDATING_TIMEOUT,
)


def get_ipv6_addr(child):
child.expect_exact('>')
child.sendline('ifconfig')
child.expect_exact(">")
child.sendline("ifconfig")
if USE_ETHOS == 0:
# Get device global address
child.expect(
Expand All @@ -87,8 +88,7 @@ def get_ipv6_addr(child):
# Get device local address
child.expect_exact("Link type: wired")
child.expect(
r"inet6 addr: (?P<lladdr>[0-9a-fA-F:]+:[A-Fa-f:0-9]+)"
" scope: link VAL"
r"inet6 addr: (?P<lladdr>[0-9a-fA-F:]+:[A-Fa-f:0-9]+)" " scope: link VAL"
)
addr = "{}%{}".format(child.match.group("lladdr").lower(), TAP)
return addr
Expand Down Expand Up @@ -127,7 +127,7 @@ def seq_no(child):
utils.test_utils_interactive_sync_shell(child, 5, 1)
# get version of currently running image
# "seq_no: 0x00000000"
child.sendline('suit seq_no')
child.sendline("suit seq_no")
child.expect(r"seq_no: (?P<seq_no>0x[0-9a-fA-F:]+)\r\n")
app_ver = int(child.match.group("seq_no"), 16)
return app_ver
Expand All @@ -136,7 +136,7 @@ def seq_no(child):
def running_slot(child):
utils.test_utils_interactive_sync_shell(child, 5, 1)

child.sendline('current-slot')
child.sendline("current-slot")
child.expect(r"Running from slot (\d+)\r\n")
slot = int(child.match.group(1))
return slot
Expand All @@ -151,7 +151,7 @@ def _test_invalid_version(child, client, app_ver):


def _test_invalid_signature(child, client, app_ver):
publish(TMPDIR.name, COAP_HOST, app_ver + 1, 'invalid_keys')
publish(TMPDIR.name, COAP_HOST, app_ver + 1, "invalid_keys")
notify(COAP_HOST, client, app_ver + 1)
child.expect_exact("suit_coap: trigger received")
child.expect_exact("suit: verifying manifest signature")
Expand Down Expand Up @@ -184,7 +184,7 @@ def _test_successful_update(child, client, app_ver):


def _test_suit_command_is_there(child):
child.sendline('suit')
child.sendline("suit")
child.expect_exact("Usage: suit fetch <manifest url>")


Expand Down

0 comments on commit 7dbc1c9

Please sign in to comment.