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

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

Move test mcuboot to use new ztest API.

Signed-off-by: default avatarZhao Shuai <shuai1x.zhao@intel.com>
parent 014628a7
Loading
Loading
Loading
Loading
+1 −0
Changes for tests/subsys/dfu/mcuboot/prj.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ CONFIG_IMG_MANAGER=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/mcuboot/prj_native_posix.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,3 +4,4 @@ CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_BLOCK_BUF_SIZE=512
CONFIG_ZTEST_NEW_API=y
+1 −0
Changes for tests/subsys/dfu/mcuboot/prj_native_posix_64.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,3 +4,4 @@ CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_BLOCK_BUF_SIZE=512
CONFIG_ZTEST_NEW_API=y
+4 −11
Changes for tests/subsys/dfu/mcuboot/src/main.c: 4 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#define BOOT_MAGIC_VALUES {BOOT_MAGIC_VAL_W0, BOOT_MAGIC_VAL_W1,\
			   BOOT_MAGIC_VAL_W2, BOOT_MAGIC_VAL_W3 }

void test_bank_erase(void)
ZTEST(mcuboot_interface, test_bank_erase)
{
	const struct flash_area *fa;
	uint32_t temp;
@@ -48,7 +48,7 @@ void test_bank_erase(void)
	}
}

void test_request_upgrade(void)
ZTEST(mcuboot_interface, test_request_upgrade)
{
	const struct flash_area *fa;
	const uint32_t expectation[6] = {
@@ -91,7 +91,7 @@ void test_request_upgrade(void)
	zassert_equal(1, readout[0] & 0xff, "confirmation error");
}

void test_write_confirm(void)
ZTEST(mcuboot_interface, test_write_confirm)
{
	const uint32_t img_magic[4] = BOOT_MAGIC_VALUES;
	uint32_t readout[ARRAY_SIZE(img_magic)];
@@ -135,11 +135,4 @@ void test_write_confirm(void)
	zassert_equal(1, readout[0] & 0xff, "confirmation error");
}

void test_main(void)
{
	ztest_test_suite(test_mcuboot_interface,
			 ztest_unit_test(test_bank_erase),
			 ztest_unit_test(test_request_upgrade),
			 ztest_unit_test(test_write_confirm));
	ztest_run_test_suite(test_mcuboot_interface);
}
ZTEST_SUITE(mcuboot_interface, NULL, NULL, NULL, NULL, NULL);