From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5D75ECAAD3 for ; Mon, 5 Sep 2022 15:55:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3DCBC8492D; Mon, 5 Sep 2022 17:55:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="cCfSGath"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A05258483F; Mon, 5 Sep 2022 17:55:11 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 013B48483F for ; Mon, 5 Sep 2022 17:55:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662393306; bh=+ywOQ0ZYEhZebRysGk4oIyRTnR/pG0jVqiNOc8AtTIs=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=cCfSGathym1Sx08WJucO2jRntBKzbjE8GfUwKhikJB9gQGgSdLD7HzVbciyf3PnrT QYbJgE0mNh6bU6F/mipImxKPcPJHXNcU2sWhnxpgjmEDmHWhDixFQgxElSsIhj10wU 8nwCaPbS52bfGPl4m0T4MVoO7AQYJczCbWP3QfUw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.67] ([84.118.157.2]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJVDW-1op5fd489Q-00Joi6; Mon, 05 Sep 2022 17:55:06 +0200 Message-ID: <6bd28d43-5ce8-cd91-760f-6fdb58c798bd@gmx.de> Date: Mon, 5 Sep 2022 17:55:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v16 10/10] test: unit test for eficonfig Content-Language: en-US To: Masahisa Kojima Cc: Ilias Apalodimas , Simon Glass , Takahiro Akashi , Mark Kettenis , u-boot@lists.denx.de References: <20220905124803.2909-1-masahisa.kojima@linaro.org> <20220905124803.2909-11-masahisa.kojima@linaro.org> From: Heinrich Schuchardt In-Reply-To: <20220905124803.2909-11-masahisa.kojima@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:l1JCIW/igPEPNLtCmmtGDyEiLZbSPfoCZ2EzS2+aJ7KJOWD83lT k44dCXWYw/6Z27rf7tvqfSIoiPBV2UL0a5h8g5MVcyxe+zKhFH24paDMRgvu/co4rLKJ+0b obNv0kZ97zMwo0A4jwOHhEzDDmNTdpdPghTqSS7aQRXyxXQVGQI9wBPM+UogQKez/wM4znm Q45fKK4N38XaZ09NkholA== X-UI-Out-Filterresults: notjunk:1;V03:K0:3u/0tHEYxVA=:vwNTLcgTAdFZMW44XKzqNP 241Y8/KJV92t3aPjKd62iWPgond28bVuAn9TXYPsCCd8qJysl1iCek0nGCBqDu7Ok6uy0nCIx 05B9gdYfdScfITWUuP/ttUJnF6sEY1wjv6gdV9tXbHSzLmEw44DGix8RNkWjDL4SIWrjhgFE8 IpSRT/R1/TObedvmX6TO/I5ECnICq0BcyD4UDJB5Lt3mLWwGPO7RGEPjr+IsbUGnbuDpce33i XqJgaKv3eh74GDYq7cWNkauvU7+fkJRFSvizh5J2gRhRkPx4W5/JXipcxw98WRjh7dnIlmweI MZRTyFnGRez8lcF0tIL33JKtRKc7loIVdViODYxyn3mwRVdtJUnEWCIJ1Pvetq9Ujn4uhIkvo Sis3/5ljV2txaB355P0Q6lAcs7fjYm4UTIvoM1BN5bo5c6rnG4VWTkKlT2fnQtPZqHPSfow9B KtlikwH7z/uwBwS+POwdlKEwashR+AvYBpLwdxcs7rGSQlndjzusB+ezpO9SCrtkGdkMykPKv 1Wk/MMAC7TjNBvkVSdhj2LhMVsexW5shtxSG1F+VkSim5N+VW9pDUuvPNwXOsZKmNLvLXiwDm 9uIgezVW+pOTnilGAtZN8pnnSajQeKXiL1a9Sjs0VAp+XcjyBpMcseBU9LQGTy4gUXOogNZP6 fe6hTRDERYEtA3I8yhYHnS1w9eMRFyI6OIK/zDiiP4dcWSqzGoxzmerzEzRTPiAqOIr5zdgUs bVtsVntdGLIwsYaG4wuugvD+gh+PN3qa7Corx45DhzxfZBdywoTv5VYRct1yuzM7UCCRN9J3A SN0lr4sBkluMdzhBJsYYHKw/DumhLKKDbNs8kRPj1MplqZuG8AIsqLyfgJgjYcbhZ9eTTS88K 2mRgZ2bnAU48sBTGB4pf7urNGGB9sMVdNSekqOID8tWi3KaVL3JXf1eJKwgGryL5EPTxY5bSZ wiU+Ttl1R+gNglHVhbcvc0QFd2bH3baThaUGvodrtJWBx5Lc51DX4OvmE4eI+WzgZTtmKuUBs Ih2TC6WxuxjgJhJFu2ikC/wk+TEYGPtQU53UxO7xUnwBiCk/fLtfcnkNYT18Mc1v4Jcw75vlf XBXqRNd0wMtA+prRCzm0fqbmKiT6ctCUsNfoIUcYIuP3UnoctkRea5JLqyNaWMcZ/pBHSc32h zGhjeZlVCQVUD20tBIs9G0UuWz X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 9/5/22 14:48, Masahisa Kojima wrote: > Provide a unit test for the eficonfig command. > > Signed-off-by: Masahisa Kojima > Acked-by: Ilias Apalodimas > --- > Changes in v16: > - call u_boot_console.restart_uboot() to clean the previous test state The test is still failing: https://source.denx.de/u-boot/custodians/u-boot-efi/-/jobs/492069/raw The same can be seen when running 'make tests' locally. Best regards Heinrich > > Changes in v14: > - update to support media device enumeration in eficonfig startup > - move no block device test to the last test case > > Changes in v12: > - update menu handling > > Changes in v11: > - fix expected result when no BootOrder is defined > > Newly added in v10 > > configs/sandbox_defconfig | 1 + > test/py/tests/test_eficonfig/conftest.py | 40 ++ > .../py/tests/test_eficonfig/test_eficonfig.py | 354 ++++++++++++++++++ > 3 files changed, 395 insertions(+) > create mode 100644 test/py/tests/test_eficonfig/conftest.py > create mode 100644 test/py/tests/test_eficonfig/test_eficonfig.py > > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig > index eba7bcbb48..48c60c606d 100644 > --- a/configs/sandbox_defconfig > +++ b/configs/sandbox_defconfig > @@ -93,6 +93,7 @@ CONFIG_CMD_LINK_LOCAL=3Dy > CONFIG_CMD_ETHSW=3Dy > CONFIG_CMD_BMP=3Dy > CONFIG_CMD_BOOTCOUNT=3Dy > +CONFIG_CMD_EFICONFIG=3Dy > CONFIG_CMD_EFIDEBUG=3Dy > CONFIG_CMD_RTC=3Dy > CONFIG_CMD_TIME=3Dy > diff --git a/test/py/tests/test_eficonfig/conftest.py b/test/py/tests/te= st_eficonfig/conftest.py > new file mode 100644 > index 0000000000..f289df0362 > --- /dev/null > +++ b/test/py/tests/test_eficonfig/conftest.py > @@ -0,0 +1,40 @@ > +# SPDX-License-Identifier: GPL-2.0+ > + > +"""Fixture for UEFI eficonfig test > +""" > + > +import os > +import shutil > +from subprocess import check_call > +import pytest > + > +@pytest.fixture(scope=3D'session') > +def efi_eficonfig_data(u_boot_config): > + """Set up a file system to be used in UEFI "eficonfig" command > + tests > + > + Args: > + u_boot_config -- U-boot configuration. > + > + Return: > + A path to disk image to be used for testing > + """ > + mnt_point =3D u_boot_config.persistent_data_dir + '/test_efi_eficon= fig' > + image_path =3D u_boot_config.persistent_data_dir + '/efi_eficonfig.= img' > + > + shutil.rmtree(mnt_point, ignore_errors=3DTrue) > + os.mkdir(mnt_point, mode =3D 0o755) > + > + with open(mnt_point + '/initrd-1.img', 'w', encoding =3D 'ascii') a= s file: > + file.write("initrd 1") > + > + with open(mnt_point + '/initrd-2.img', 'w', encoding =3D 'ascii') a= s file: > + file.write("initrd 2") > + > + shutil.copyfile(u_boot_config.build_dir + '/lib/efi_loader/initrddu= mp.efi', > + mnt_point + '/initrddump.efi') > + > + check_call(f'virt-make-fs --partition=3Dgpt --size=3D+1M --type=3Dv= fat {mnt_point} {image_path}', > + shell=3DTrue) > + > + return image_path > diff --git a/test/py/tests/test_eficonfig/test_eficonfig.py b/test/py/te= sts/test_eficonfig/test_eficonfig.py > new file mode 100644 > index 0000000000..c1fe07eb8b > --- /dev/null > +++ b/test/py/tests/test_eficonfig/test_eficonfig.py > @@ -0,0 +1,354 @@ > +# SPDX-License-Identifier: GPL-2.0+ > +""" Unit test for UEFI menu-driven configuration > +""" > + > +import pytest > +import time > + > +@pytest.mark.boardspec('sandbox') > +@pytest.mark.buildconfigspec('cmd_eficonfig') > +@pytest.mark.buildconfigspec('cmd_bootefi_bootmgr') > +def test_efi_eficonfig(u_boot_console, efi_eficonfig_data): > + > + def send_user_input_and_wait(user_str, expect_str): > + time.sleep(0.1) # TODO: does not work correctly without sleep > + u_boot_console.run_command(cmd=3Duser_str, wait_for_prompt=3DFa= lse, > + wait_for_echo=3DTrue, send_nl=3DFals= e) > + u_boot_console.run_command(cmd=3D'\x0d', wait_for_prompt=3DFals= e, > + wait_for_echo=3DFalse, send_nl=3DFal= se) > + if expect_str is not None: > + for i in expect_str: > + u_boot_console.p.expect([i]) > + > + def press_up_down_enter_and_wait(up_count, down_count, enter, expec= t_str): > + # press UP key > + for i in range(up_count): > + u_boot_console.run_command(cmd=3D'\x1b\x5b\x41', wait_for_p= rompt=3DFalse, > + wait_for_echo=3DFalse, send_nl= =3DFalse) > + # press DOWN key > + for i in range(down_count): > + u_boot_console.run_command(cmd=3D'\x1b\x5b\x42', wait_for_p= rompt=3DFalse, > + wait_for_echo=3DFalse, send_nl= =3DFalse) > + # press ENTER if requested > + if enter: > + u_boot_console.run_command(cmd=3D'\x0d', wait_for_prompt=3D= False, > + wait_for_echo=3DFalse, send_nl= =3DFalse) > + # wait expected output > + if expect_str is not None: > + for i in expect_str: > + u_boot_console.p.expect([i]) > + > + def press_escape_key(wait_prompt): > + u_boot_console.run_command(cmd=3D'\x1b', wait_for_prompt=3Dwait= _prompt, wait_for_echo=3DFalse, send_nl=3DFalse) > + > + def press_enter_key(wait_prompt): > + u_boot_console.run_command(cmd=3D'\x0d', wait_for_prompt=3Dwait= _prompt, > + wait_for_echo=3DFalse, send_nl=3DFal= se) > + > + def check_current_is_maintenance_menu(): > + for i in ('UEFI Maintenance Menu', 'Add Boot Option', 'Edit Boo= t Option', > + 'Change Boot Order', 'Delete Boot Option', 'Quit'): > + u_boot_console.p.expect([i]) > + > + """ Unit test for "eficonfig" command > + The menu-driven interface is used to set up UEFI load options. > + The bootefi bootmgr loads initrddump.efi as a payload. > + The crc32 of the loaded initrd.img is checked > + > + Args: > + u_boot_console -- U-Boot console > + efi__data -- Path to the disk image used for testing. > + Test disk image has following files. > + initrd-1.img > + initrddump.efi > + initrd-2.img > + > + """ > + > + # Restart the system to clean the previous state > + u_boot_console.restart_uboot() > + > + with u_boot_console.temporary_timeout(500): > + # > + # Test Case 1: Check the menu is displayed > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + for i in ('UEFI Maintenance Menu', 'Add Boot Option', 'Edit Boo= t Option', > + 'Change Boot Order', 'Delete Boot Option', 'Quit'): > + u_boot_console.p.expect([i]) > + # Select "Add Boot Option" > + press_enter_key(False) > + for i in ('Add Boot Option', 'Description:', 'File', 'Initrd Fi= le', 'Optional Data', > + 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + press_escape_key(False) > + check_current_is_maintenance_menu() > + # return to U-Boot console > + press_escape_key(True) > + > + # > + # Test Case 2: check auto generated media device entry > + # > + > + # bind the test disk image for succeeding tests > + u_boot_console.run_command(cmd =3D f'host bind 0 {efi_eficonfig= _data}') > + > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + > + # Change the Boot Order > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + for i in ('host 0:1', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + # disable auto generated boot option for succeeding test > + u_boot_console.run_command(cmd=3D' ', wait_for_prompt=3DFalse, > + wait_for_echo=3DFalse, send_nl= =3DFalse) > + # Save the BootOrder > + press_up_down_enter_and_wait(0, 1, True, None) > + check_current_is_maintenance_menu() > + > + # > + # Test Case 3: Add first Boot Option and load it > + # > + > + # Select 'Add Boot Option' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + > + # Press the enter key to select 'Description:' entry, then ente= r Description > + press_up_down_enter_and_wait(0, 0, True, 'enter description:') > + # Send Description user input, press ENTER key to complete > + send_user_input_and_wait('test 1', 'Quit') > + > + # Set EFI image(initrddump.efi) > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'host 0:1') > + # Select 'host 0:1' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + # Press down key to select "initrddump.efi" entry followed by t= he enter key > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + > + # Set Initrd file(initrd-1.img) > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'host 0:1') > + # Select 'host 0:1' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + # Press down key to select "initrd-1.img" entry followed by the= enter key > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + > + # Set optional_data > + press_up_down_enter_and_wait(0, 3, True, 'Optional Data:') > + # Send Description user input, press ENTER key to complete > + send_user_input_and_wait('nocolor', None) > + for i in ('Description: test 1', 'File: host 0:1/initrddump.efi= ', > + 'Initrd File: host 0:1/initrd-1.img', 'Optional Data:= nocolor', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + > + # Save the Boot Option > + press_up_down_enter_and_wait(0, 4, True, None) > + check_current_is_maintenance_menu() > + > + # Check the newly added Boot Option is handled correctly > + # Return to U-Boot console > + press_escape_key(True) > + u_boot_console.run_command(cmd =3D 'bootefi bootmgr') > + response =3D u_boot_console.run_command(cmd =3D 'load', wait_fo= r_echo=3DFalse) > + assert 'crc32: 0x181464af' in response > + u_boot_console.run_command(cmd =3D 'exit', wait_for_echo=3DFals= e) > + > + # > + # Test Case 4: Add second Boot Option and load it > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + > + # Select 'Add Boot Option' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + > + # Press the enter key to select 'Description:' entry, then ente= r Description > + press_up_down_enter_and_wait(0, 0, True, 'enter description:') > + # Send Description user input, press ENTER key to complete > + send_user_input_and_wait('test 2', 'Quit') > + > + # Set EFI image(initrddump.efi) > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'host 0:1') > + # Select 'host 0:1' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + # Press down key to select "initrddump.efi" entry followed by t= he enter key > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + > + # Set Initrd file(initrd-2.img) > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'host 0:1') > + # Select 'host 0:1' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + # Press down key to select "initrd-2.img" entry followed by the= enter key > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + > + # Set optional_data > + press_up_down_enter_and_wait(0, 3, True, 'Optional Data:') > + # Send Description user input, press ENTER key to complete > + send_user_input_and_wait('nocolor', None) > + for i in ('Description: test 2', 'File: host 0:1/initrddump.efi= ', > + 'Initrd File: host 0:1/initrd-2.img', 'Optional Data:= nocolor', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + > + # Save the Boot Option > + press_up_down_enter_and_wait(0, 4, True, 'Quit') > + > + # Change the Boot Order > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + press_up_down_enter_and_wait(0, 1, False, 'Quit') > + # move 'test 1' to the second entry > + u_boot_console.run_command(cmd=3D'+', wait_for_prompt=3DFalse, > + wait_for_echo=3DFalse, send_nl= =3DFalse) > + for i in ('test 2', 'test 1', 'host 0:1', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + # Save the BootOrder > + press_up_down_enter_and_wait(0, 3, True, None) > + check_current_is_maintenance_menu() > + > + # Check the newly added Boot Option is handled correctly > + # Return to U-Boot console > + press_escape_key(True) > + u_boot_console.run_command(cmd =3D 'bootefi bootmgr') > + response =3D u_boot_console.run_command(cmd =3D 'load', wait_fo= r_echo=3DFalse) > + assert 'crc32: 0x811d3515' in response > + u_boot_console.run_command(cmd =3D 'exit', wait_for_echo=3DFals= e) > + > + # > + # Test Case 5: Change BootOrder and load it > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + > + # Change the Boot Order > + press_up_down_enter_and_wait(0, 2, True, None) > + # Check the curren BootOrder > + for i in ('test 2', 'test 1', 'host 0:1', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + # move 'test 2' to the second entry > + u_boot_console.run_command(cmd=3D'-', wait_for_prompt=3DFalse, > + wait_for_echo=3DFalse, send_nl= =3DFalse) > + for i in ('test 1', 'test 2', 'host 0:1', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + # Save the BootOrder > + press_up_down_enter_and_wait(0, 2, True, None) > + check_current_is_maintenance_menu() > + > + # Return to U-Boot console > + press_escape_key(True) > + u_boot_console.run_command(cmd =3D 'bootefi bootmgr') > + response =3D u_boot_console.run_command(cmd =3D 'load', wait_fo= r_echo=3DFalse) > + assert 'crc32: 0x181464af' in response > + u_boot_console.run_command(cmd =3D 'exit', wait_for_echo=3DFals= e) > + > + # > + # Test Case 6: Delete Boot Option(label:test 2) > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + > + # Select 'Delete Boot Option' > + press_up_down_enter_and_wait(0, 3, True, None) > + # Check the current BootOrder > + for i in ('test 1', 'test 2', 'Quit'): > + u_boot_console.p.expect([i]) > + > + # Delete 'test 2' > + press_up_down_enter_and_wait(0, 1, True, None) > + for i in ('test 1', 'Quit'): > + u_boot_console.p.expect([i]) > + press_escape_key(False) > + check_current_is_maintenance_menu() > + # Return to U-Boot console > + press_escape_key(True) > + > + # > + # Test Case 7: Edit Boot Option > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + # Select 'Edit Boot Option' > + press_up_down_enter_and_wait(0, 1, True, None) > + # Check the curren BootOrder > + for i in ('test 1', 'Quit'): > + u_boot_console.p.expect([i]) > + press_up_down_enter_and_wait(0, 0, True, None) > + for i in ('Description: test 1', 'File: host 0:1/initrddump.efi= ', > + 'Initrd File: host 0:1/initrd-1.img', 'Optional Data:= nocolor', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + > + # Press the enter key to select 'Description:' entry, then ente= r Description > + press_up_down_enter_and_wait(0, 0, True, 'enter description:') > + # Send Description user input, press ENTER key to complete > + send_user_input_and_wait('test 3', 'Quit') > + > + # Set EFI image(initrddump.efi) > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'host 0:1') > + # Select 'host 0:1' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + # Press down key to select "initrddump.efi" entry followed by t= he enter key > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + > + # Set Initrd file(initrd-2.img) > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'host 0:1') > + # Select 'host 0:1' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + # Press down key to select "initrd-1.img" entry followed by the= enter key > + press_up_down_enter_and_wait(0, 2, True, 'Quit') > + > + # Set optional_data > + press_up_down_enter_and_wait(0, 3, True, 'Optional Data:') > + # Send Description user input, press ENTER key to complete > + send_user_input_and_wait('', None) > + for i in ('Description: test 3', 'File: host 0:1/initrddump.efi= ', > + 'Initrd File: host 0:1/initrd-2.img', 'Optional Data:= ', 'Save', 'Quit'): > + u_boot_console.p.expect([i]) > + > + # Save the Boot Option > + press_up_down_enter_and_wait(0, 4, True, 'Quit') > + press_escape_key(False) > + check_current_is_maintenance_menu() > + > + # Check the updated Boot Option is handled correctly > + # Return to U-Boot console > + press_escape_key(True) > + u_boot_console.run_command(cmd =3D 'bootefi bootmgr') > + response =3D u_boot_console.run_command(cmd =3D 'load', wait_fo= r_echo=3DFalse) > + assert 'crc32: 0x811d3515' in response > + u_boot_console.run_command(cmd =3D 'exit', wait_for_echo=3DFals= e) > + > + # > + # Test Case 8: Delete Boot Option(label:test 3) > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + > + # Select 'Delete Boot Option' > + press_up_down_enter_and_wait(0, 3, True, None) > + # Check the curren BootOrder > + for i in ('test 3', 'Quit'): > + u_boot_console.p.expect([i]) > + > + # Delete 'test 3' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + press_escape_key(False) > + check_current_is_maintenance_menu() > + # Return to U-Boot console > + press_escape_key(True) > + > + # remove the host device > + u_boot_console.run_command(cmd =3D f'host bind -r 0') > + > + # > + # Test Case 9: No block device found > + # > + u_boot_console.run_command('eficonfig', wait_for_prompt=3DFalse= ) > + > + # Select 'Add Boot Option' > + press_up_down_enter_and_wait(0, 0, True, 'Quit') > + > + # Set EFI image > + press_up_down_enter_and_wait(0, 1, True, 'Quit') > + press_up_down_enter_and_wait(0, 0, True, 'No block device found= !') > + press_escape_key(False) > + check_current_is_maintenance_menu() > + # Return to U-Boot console > + press_escape_key(True)