diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-14 16:40:35 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-25 13:54:33 -0400 |
commit | fc9c0e0771cad76b24f73bb64c105b6ea39721ca (patch) | |
tree | 354bcb5d5fae27ae957696bab20ce2574372fbe0 /test/boot | |
parent | 472317cb12e534f56b631365987934960dfb0a3f (diff) | |
download | u-boot-fc9c0e0771cad76b24f73bb64c105b6ea39721ca.tar.gz u-boot-fc9c0e0771cad76b24f73bb64c105b6ea39721ca.tar.bz2 u-boot-fc9c0e0771cad76b24f73bb64c105b6ea39721ca.zip |
expo: cedit: Support writing settings to environment vars
Add a command to write cedit settings to environment variables so that
they can be stored with 'saveenv'.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/boot')
-rw-r--r-- | test/boot/cedit.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 659c47ed35..26a69f0323 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -6,6 +6,7 @@ #include <common.h> #include <cedit.h> +#include <env.h> #include <expo.h> #include <mapmem.h> #include <dm/ofnode.h> @@ -112,3 +113,35 @@ static int cedit_fdt(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_fdt, 0); + +/* Check the cedit write_env command */ +static int cedit_env(struct unit_test_state *uts) +{ + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene_obj_menu *menu; + struct scene *scn; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get a menu to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + ut_assertok(run_command("cedit write_env -v", 0)); + ut_assert_nextlinen("c.cpu-speed=7"); + ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz"); + ut_assert_nextlinen("c.power-loss=10"); + ut_assert_nextlinen("c.power-loss-str=Always Off"); + ut_assert_console_end(); + + ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0)); + ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str")); + + return 0; +} +BOOTSTD_TEST(cedit_env, 0); |