Skip to content
Snippets Groups Projects
Commit 66911d6c authored by Francisco Acosta's avatar Francisco Acosta Committed by Kaspar Schleiser
Browse files

tests/riotboot: add basic automatic test in python

parent f1c57b21
No related branches found
No related tags found
No related merge requests found
......@@ -14,5 +14,8 @@ This test should foremost give you an overview how to use riotboot:
riotboot and the RIOT image with headers included. This should boot
as a normal application.
In this test two modules `riot_hdr` and `slot_util` are used to showcase
In this test two modules `riotboot_hdr` and `riotboot_slot` are used to showcase
the access to riotboot shared functions.
- `make test` can be executed to run the automatic Python test that checks
basic functionalities of riotboot
#!/usr/bin/env python3
# Copyright (C) 2018 Federico Pellegrin <fede@evolware.org>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def testfunc(child):
# Ask for current slot, should be 0 (riotboot slot)
child.sendline("curslotnr")
child.expect_exact("Current slot=0")
child.expect('>')
# Ask for current slot header info and checks for basic output integrity
child.sendline("curslothdr")
# Magic number is "RIOT" (always in little endian)
child.expect_exact("Image magic_number: 0x544f4952")
# Other info is hardware/app dependant so we just check basic compliance
child.expect("Image Version: 0x[0-9a-fA-F]{8}")
child.expect("Image start address: 0x[0-9a-fA-F]{8}")
child.expect("Header chksum: 0x[0-9a-fA-F]{8}")
child.expect('>')
# Ask for address of slot 0
child.sendline("getslotaddr 0")
child.expect("Slot 0 address=0x[0-9a-fA-F]{8}")
child.expect('>')
# Ask for data of all slots
child.sendline("dumpaddrs")
child.expect("slot 0: metadata: 0x[0-9a-fA-F]{1,8} image: 0x[0-9a-fA-F]{8}")
child.expect('>')
if __name__ == "__main__":
sys.exit(run(testfunc))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment