summaryrefslogtreecommitdiff
path: root/test/boot
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-10-11 18:47:17 +0300
committerSimon Glass <sjg@chromium.org>2022-10-18 06:17:13 +0300
commita753190a0c544d211faf13a296bd80e830150158 (patch)
tree71b2f1a627e28acebe7916d3c810463e58ff5af0 /test/boot
parent87c97cb1f9a45567488edd260539467b7b1a869a (diff)
downloadu-boot-a753190a0c544d211faf13a296bd80e830150158.tar.xz
test: Move common FIT code into a separate fit_util file
To avoid duplicating code, create a new fit_util module which provides various utility functions for FIT. Move this code out from the existing test_fit.py and refactor it with addition parameters. Fix up pylint warnings in the conversion. This involves no functional change. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/boot')
-rw-r--r--test/boot/bootstd_common.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_common.c
index 59d46bef0c..7a40836507 100644
--- a/test/boot/bootstd_common.c
+++ b/test/boot/bootstd_common.c
@@ -17,6 +17,7 @@
#include <u-boot/crc.h>
#include "bootstd_common.h"
+/* tracks whether bootstd_setup_for_tests() has been run yet */
bool vbe_setup_done;
/* set up MMC for VBE tests */
@@ -27,6 +28,9 @@ int bootstd_setup_for_tests(void)
struct blk_desc *desc;
int ret;
+ if (vbe_setup_done)
+ return 0;
+
/* Set up the version string */
ret = uclass_get_device(UCLASS_MMC, 1, &mmc);
if (ret)
@@ -46,6 +50,8 @@ int bootstd_setup_for_tests(void)
if (blk_dwrite(desc, NVDATA_START_BLK, 1, buf) != 1)
return log_msg_ret("wr2", -EIO);
+ vbe_setup_done = true;
+
return 0;
}
@@ -65,17 +71,12 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct unit_test *tests = UNIT_TEST_SUITE_START(bootstd_test);
const int n_ents = UNIT_TEST_SUITE_COUNT(bootstd_test);
+ int ret;
- if (!vbe_setup_done) {
- int ret;
-
- ret = bootstd_setup_for_tests();
- if (ret) {
- printf("Failed to set up for bootstd tests (err=%d)\n",
- ret);
- return CMD_RET_FAILURE;
- }
- vbe_setup_done = true;
+ ret = bootstd_setup_for_tests();
+ if (ret) {
+ printf("Failed to set up for bootstd tests (err=%d)\n", ret);
+ return CMD_RET_FAILURE;
}
return cmd_ut_category("bootstd", "bootstd_test_",