Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/suit_update: some test fixes #19643

Merged
merged 3 commits into from
May 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions examples/suit_update/tests-with-config/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
IFACE = os.getenv("IFACE", "tapbr0")
TMPDIR = tempfile.TemporaryDirectory()

TRIGGER_RECEIVED_MSG = "suit_worker: started."
REBOOTING_MSG = "suit_worker: rebooting..."


def get_iface_addr(iface):
kaspar030 marked this conversation as resolved.
Show resolved Hide resolved
out = subprocess.check_output(["ip", "a", "s", "dev", iface]).decode()
Expand Down Expand Up @@ -94,6 +97,8 @@ def wait_for_update(child):

def get_ipv6_addr(child):
child.expect_exact(">")
# give the stack some time to make the address non-tentataive
time.sleep(2)
child.sendline("ifconfig")
if USE_ETHOS == 0:
# Get device global address
Expand Down Expand Up @@ -176,15 +181,15 @@ def running_slot(child):
def _test_invalid_version(child, client, app_ver):
publish(TMPDIR.name, COAP_HOST, app_ver)
notify(COAP_HOST, client, app_ver)
child.expect_exact("suit_coap: trigger received")
child.expect_exact(TRIGGER_RECEIVED_MSG)
child.expect_exact("suit: verifying manifest signature")
child.expect_exact("seq_nr <= running image")


def _test_invalid_signature(child, client, app_ver):
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(TRIGGER_RECEIVED_MSG)
child.expect_exact("suit: verifying manifest signature")
child.expect_exact("Unable to validate signature")

Expand All @@ -194,7 +199,7 @@ def _test_successful_update(child, client, app_ver):
# Trigger update process, verify it validates manifest correctly
publish(TMPDIR.name, COAP_HOST, version)
notify(COAP_HOST, client, version)
child.expect_exact("suit_coap: trigger received")
child.expect_exact(TRIGGER_RECEIVED_MSG)
child.expect_exact("suit: verifying manifest signature")
child.expect(
r"SUIT policy check OK.\r\n",
Expand All @@ -205,11 +210,10 @@ def _test_successful_update(child, client, app_ver):
pass
# Check successful install
child.expect_exact("Install correct payload")
child.expect_exact("Install correct payload")

# Wait for reboot on non-native BOARDs
if BOARD != "native":
child.expect_exact("suit_coap: rebooting...")
child.expect_exact(REBOOTING_MSG)
# Verify client is reachable and get address
client = get_reachable_addr(child)
assert seq_no(child) == version
Expand Down