Commit 014628a7 authored by Zhao Shuai's avatar Zhao Shuai Committed by Carles Cufi
Browse files

tests: subsys: dfu: move img_util to new ztest API

Move test img_util to use new ztest API.

Signed-off-by: default avatarZhao Shuai <shuai1x.zhao@intel.com>
parent 419c540a
Loading
Loading
Loading
Loading
+1 −0
Changes for tests/subsys/dfu/img_util/prj.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -6,3 +6,4 @@ CONFIG_IMG_ENABLE_IMAGE_CHECK=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_BLOCK_BUF_SIZE=512
CONFIG_ARM_MPU=n
CONFIG_ZTEST_NEW_API=y
+1 −0
Changes for tests/subsys/dfu/img_util/prj_native_posix.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ CONFIG_IMG_MANAGER=y
CONFIG_IMG_ENABLE_IMAGE_CHECK=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_BLOCK_BUF_SIZE=512
CONFIG_ZTEST_NEW_API=y
+1 −0
Changes for tests/subsys/dfu/img_util/prj_native_posix_64.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ CONFIG_IMG_MANAGER=y
CONFIG_IMG_ENABLE_IMAGE_CHECK=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_BLOCK_BUF_SIZE=512
CONFIG_ZTEST_NEW_API=y
+4 −12
Changes for tests/subsys/dfu/img_util/src/main.c: 4 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
#include <zephyr/storage/flash_map.h>
#include <zephyr/dfu/flash_img.h>

void test_init_id(void)
ZTEST(img_util, test_init_id)
{
	struct flash_img_context ctx_no_id;
	struct flash_img_context ctx_id;
@@ -33,7 +33,7 @@ void test_init_id(void)
		      "Partition ID is not set correctly");
}

void test_collecting(void)
ZTEST(img_util, test_collecting)
{
	const struct flash_area *fa;
	struct flash_img_context ctx;
@@ -108,7 +108,7 @@ void test_collecting(void)
#endif
}

void test_check_flash(void)
ZTEST(img_util, test_check_flash)
{
	/* echo $'0123456789abcdef\nfedcba9876543201' > tst.sha
	 * hexdump tst.sha
@@ -158,12 +158,4 @@ void test_check_flash(void)
	flash_area_close(ctx.flash_area);
}

void test_main(void)
{
	ztest_test_suite(test_util,
			ztest_unit_test(test_collecting),
			ztest_unit_test(test_init_id),
			ztest_unit_test(test_check_flash)
			);
	ztest_run_test_suite(test_util);
}
ZTEST_SUITE(img_util, NULL, NULL, NULL, NULL, NULL);