tests: boot: with_mcumgr: Add swap using offset test
Adds a variation of the test which tests swap using offset mode, based on the swap using move test Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
parent
9b8b418a2c
commit
141f7fa427
2 changed files with 37 additions and 16 deletions
|
@ -32,6 +32,13 @@ def create_signed_image(build_dir: Path, app_build_dir: Path, version: str) -> P
|
|||
return image_to_test
|
||||
|
||||
|
||||
def get_upgrade_string_to_verify(build_dir: Path) -> str:
|
||||
sysbuild_config = Path(build_dir) / 'zephyr' / '.config'
|
||||
if find_in_config(sysbuild_config, 'SB_CONFIG_MCUBOOT_MODE_SWAP_USING_OFFSET'):
|
||||
return 'Starting swap using offset algorithm'
|
||||
return 'Starting swap using move algorithm'
|
||||
|
||||
|
||||
def clear_buffer(dut: DeviceAdapter) -> None:
|
||||
disconnect = False
|
||||
if not dut.is_device_connected():
|
||||
|
@ -71,9 +78,10 @@ def test_upgrade_with_confirm(dut: DeviceAdapter, shell: Shell, mcumgr: MCUmgr):
|
|||
|
||||
dut.connect()
|
||||
output = dut.readlines_until('Launching primary slot application')
|
||||
upgrade_string_to_verify = get_upgrade_string_to_verify(dut.device_config.build_dir)
|
||||
match_lines(output, [
|
||||
'Swap type: test',
|
||||
'Starting swap using move algorithm'
|
||||
upgrade_string_to_verify
|
||||
])
|
||||
logger.info('Verify new APP is booted')
|
||||
check_with_shell_command(shell, new_version, swap_type='test')
|
||||
|
@ -87,7 +95,7 @@ def test_upgrade_with_confirm(dut: DeviceAdapter, shell: Shell, mcumgr: MCUmgr):
|
|||
dut.connect()
|
||||
output = dut.readlines_until('Launching primary slot application')
|
||||
match_no_lines(output, [
|
||||
'Starting swap using move algorithm'
|
||||
upgrade_string_to_verify
|
||||
])
|
||||
logger.info('Verify new APP is still booted')
|
||||
check_with_shell_command(shell, new_version)
|
||||
|
@ -126,9 +134,10 @@ def test_upgrade_with_revert(dut: DeviceAdapter, shell: Shell, mcumgr: MCUmgr):
|
|||
|
||||
dut.connect()
|
||||
output = dut.readlines_until('Launching primary slot application')
|
||||
upgrade_string_to_verify = get_upgrade_string_to_verify(dut.device_config.build_dir)
|
||||
match_lines(output, [
|
||||
'Swap type: test',
|
||||
'Starting swap using move algorithm'
|
||||
upgrade_string_to_verify
|
||||
])
|
||||
logger.info('Verify new APP is booted')
|
||||
check_with_shell_command(shell, new_version, swap_type='test')
|
||||
|
@ -142,7 +151,7 @@ def test_upgrade_with_revert(dut: DeviceAdapter, shell: Shell, mcumgr: MCUmgr):
|
|||
output = dut.readlines_until('Launching primary slot application')
|
||||
match_lines(output, [
|
||||
'Swap type: revert',
|
||||
'Starting swap using move algorithm'
|
||||
upgrade_string_to_verify
|
||||
])
|
||||
logger.info('Verify that MCUboot reverts update')
|
||||
check_with_shell_command(shell, origin_version)
|
||||
|
@ -202,5 +211,6 @@ def test_upgrade_signature(dut: DeviceAdapter, shell: Shell, mcumgr: MCUmgr, key
|
|||
|
||||
dut.connect()
|
||||
output = dut.readlines_until('Launching primary slot application')
|
||||
match_no_lines(output, ['Starting swap using move algorithm'])
|
||||
upgrade_string_to_verify = get_upgrade_string_to_verify(dut.device_config.build_dir)
|
||||
match_no_lines(output, [upgrade_string_to_verify])
|
||||
match_lines(output, ['Image in the secondary slot is not valid'])
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
common:
|
||||
sysbuild: true
|
||||
platform_allow:
|
||||
- nrf52840dk/nrf52840
|
||||
- nrf5340dk/nrf5340/cpuapp
|
||||
- nrf54l15dk/nrf54l15/cpuapp
|
||||
- nrf9160dk/nrf9160
|
||||
- nucleo_wba55cg
|
||||
integration_platforms:
|
||||
- nrf52840dk/nrf52840
|
||||
timeout: 600
|
||||
slow: true
|
||||
tags:
|
||||
- pytest
|
||||
- mcuboot
|
||||
- mcumgr
|
||||
tests:
|
||||
boot.with_mcumgr.test_upgrade:
|
||||
tags:
|
||||
- pytest
|
||||
- mcuboot
|
||||
- mcumgr
|
||||
platform_allow:
|
||||
- nrf52840dk/nrf52840
|
||||
integration_platforms:
|
||||
- nrf52840dk/nrf52840
|
||||
harness: pytest
|
||||
harness_config:
|
||||
pytest_root:
|
||||
- "pytest/test_upgrade.py"
|
||||
|
||||
boot.with_mcumgr.test_downgrade_prevention:
|
||||
tags:
|
||||
- pytest
|
||||
- mcuboot
|
||||
- mcumgr
|
||||
platform_allow:
|
||||
- nrf52840dk/nrf52840
|
||||
integration_platforms:
|
||||
- nrf52840dk/nrf52840
|
||||
harness: pytest
|
||||
harness_config:
|
||||
pytest_root:
|
||||
|
@ -34,3 +35,13 @@ tests:
|
|||
- mcuboot_CONFIG_MCUBOOT_DOWNGRADE_PREVENTION=y
|
||||
extra_configs:
|
||||
- CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="1.1.1+1"
|
||||
|
||||
boot.with_mcumgr.test_upgrade.swap_using_offset:
|
||||
integration_platforms:
|
||||
- nrf5340dk/nrf5340/cpuapp
|
||||
harness: pytest
|
||||
harness_config:
|
||||
pytest_root:
|
||||
- "pytest/test_upgrade.py"
|
||||
extra_args:
|
||||
- SB_CONFIG_MCUBOOT_MODE_SWAP_USING_OFFSET=y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue