Skip to content

Commit

Permalink
dfu_target_stream: Add progress cleanup
Browse files Browse the repository at this point in the history
It is necessary to erase progress for both streams before test
execution.
Remove the bootloader from sysbuild as the bootloader is not required by
the test.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
  • Loading branch information
tomchy committed May 9, 2024
1 parent 68334a4 commit 175e6a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
21 changes: 0 additions & 21 deletions tests/subsys/dfu/dfu_target_stream/Kconfig.sysbuild

This file was deleted.

20 changes: 20 additions & 0 deletions tests/subsys/dfu/dfu_target_stream/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,24 @@ static void check_flash_base_at_page_start(const struct device *dev)
"Expected FLASH_BASE to be at a page boundary.");
}

static void reset_stream_progress(const struct device *dev)
{
int err;

err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf),
FLASH_BASE, 0, NULL);
__ASSERT(err == 0, "Unable to initialiae test stream %s: %d", TEST_ID_1, err);

err = dfu_target_stream_reset();
__ASSERT(err == 0, "Unable to reset test stream %s: %d", TEST_ID_1, err);

err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf),
FLASH_BASE, 0, NULL);
__ASSERT(err == 0, "Unable to initialiae test stream %s: %d", TEST_ID_2, err);

err = dfu_target_stream_reset();
__ASSERT(err == 0, "Unable to reset test stream %s: %d", TEST_ID_2, err);
}
#else

ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress)
Expand All @@ -289,6 +307,8 @@ static void *setup(void)
page_size = get_flash_page_size(fdev);
__ASSERT(page_size <= BUF_LEN,
"BUF_LEN must be at least one page long");

reset_stream_progress(fdev);
#endif

return NULL;
Expand Down

0 comments on commit 175e6a0

Please sign in to comment.