From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: mark.kettenis@xs4all.nl, u-boot@lists.denx.de
Subject: Re: [PATCH v2 3/3] test: efi_bootmgr: add a test case for a short-form path
Date: Thu, 12 May 2022 16:10:39 +0900 [thread overview]
Message-ID: <20220512071039.GA88188@laputa> (raw)
In-Reply-To: <01a85a9a-bf19-9f06-61c1-cef99f0b7f32@gmx.de>
On Thu, May 12, 2022 at 09:02:36AM +0200, Heinrich Schuchardt wrote:
> On 5/12/22 04:29, AKASHI Takahiro wrote:
> > A short-form path starting with a file device path will be tested in
> > a new test case.
> >
> > This type of short-form path will be created with "efidebug boot add -b",
> > in particular, when a file system has no partition table.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > test/py/tests/test_efi_bootmgr/conftest.py | 25 +++++++++++++++++++
> > .../test_efi_bootmgr/test_efi_bootmgr.py | 25 +++++++++++++++++++
> > 2 files changed, 50 insertions(+)
> >
> > diff --git a/test/py/tests/test_efi_bootmgr/conftest.py b/test/py/tests/test_efi_bootmgr/conftest.py
> > index a0a754afbe1b..5cd7252671fa 100644
> > --- a/test/py/tests/test_efi_bootmgr/conftest.py
> > +++ b/test/py/tests/test_efi_bootmgr/conftest.py
> > @@ -38,3 +38,28 @@ def efi_bootmgr_data(u_boot_config):
> > shell=True)
> >
> > return image_path
> > +
> > +@pytest.fixture(scope='session')
> > +def efi_bootmgr_data2(u_boot_config):
> > + """Set up a file system without a partition table to be used
> > + in UEFI bootmanager tests
>
> Why do you want a file system without partition table? This is nothing
> the UEFI specification expects to support.
As we discussed several times in the past, a partition table in the file
system is not mandatory in U-Boot's UEFI subsystem.
> Your test should cover having
> a partition table and a device path which is file only.
>
> Best regards
>
> Heinrich
>
> > +
> > + Args:
> > + u_boot_config -- U-boot configuration.
> > +
> > + Return:
> > + A path to disk image to be used for testing
> > + """
> > + mnt_point = u_boot_config.persistent_data_dir + '/test_efi_bootmgr'
> > + image_path = u_boot_config.persistent_data_dir + '/efi_bootmgr_data2.img'
> > +
> > + shutil.rmtree(mnt_point, ignore_errors=True)
> > + os.mkdir(mnt_point, mode = 0o755)
> > +
> > + shutil.copyfile(u_boot_config.build_dir + '/lib/efi_loader/helloworld.efi',
> > + mnt_point + '/helloworld.efi')
> > +
> > + check_call(f'virt-make-fs --size=+1M --type=vfat {mnt_point} {image_path}',
> > + shell=True)
> > +
> > + return image_path
> > diff --git a/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py
> > index 75a6e7c96296..ab3d53a2dc95 100644
> > --- a/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py
> > +++ b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py
> > @@ -41,3 +41,28 @@ def test_efi_bootmgr(u_boot_console, efi_bootmgr_data):
> >
> > u_boot_console.run_command(cmd = 'efidebug boot rm 0001')
> > u_boot_console.run_command(cmd = 'efidebug boot rm 0002')
> > +
> > +@pytest.mark.boardspec('sandbox')
> > +@pytest.mark.buildconfigspec('cmd_efidebug')
> > +@pytest.mark.buildconfigspec('cmd_bootefi_bootmgr')
> > +def test_efi_bootmgr_short(u_boot_console, efi_bootmgr_data2):
> > + """ Unit test for UEFI bootmanager with a short-form path
> > + In this test case,
> > + - File system has no partition table
> > + - UEFI load option has a short-form path starting with a file device path
> > +
> > + Args:
> > + u_boot_console -- U-Boot console
> > + efi_bootmgr_data2 -- Path to the disk image used for testing.
> > + """
> > + u_boot_console.run_command(cmd = f'host bind 0 {efi_bootmgr_data2}')
> > +
> > + u_boot_console.run_command(cmd = 'efidebug boot add ' \
> > + '-b 0001 TEST2 host 0:0 helloworld.efi')
>
> This will not create a file only device path. So this does not test
> patch 1 and 2.
It does.
See the output from "efidebug boot dump" in the log.
> You could use setenv -e -i to create the boot option.
>
> Best regards
>
> Heinrich
>
> > + response = u_boot_console.run_command(cmd = 'efidebug boot dump')
> > + assert 'file_path: /helloworld.efi' in response
Furthermore, here is the check for a device path only with a file.
-Takahiro Akashi
> > + u_boot_console.run_command(cmd = 'efidebug boot next 0001')
> > + response = u_boot_console.run_command(cmd = 'bootefi bootmgr')
> > + assert 'Hello, world!' in response
> > +
> > + u_boot_console.run_command(cmd = 'efidebug boot rm 0001')
>
prev parent reply other threads:[~2022-05-12 7:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 2:29 [PATCH v2 0/3] efi_loader: bootmgr: fix a problem in loading an image from a short-path AKASHI Takahiro
2022-05-12 2:29 ` [PATCH v2 1/3] efi_loader: disk: add efi_disk_is_removable() AKASHI Takahiro
2022-05-12 6:27 ` Heinrich Schuchardt
2022-05-12 2:29 ` [PATCH v2 2/3] efi_loader: bootmgr: fix a problem in loading an image from a short-path AKASHI Takahiro
2022-05-12 6:50 ` Heinrich Schuchardt
2022-05-12 7:25 ` AKASHI Takahiro
2022-05-12 19:01 ` Heinrich Schuchardt
2022-05-12 2:29 ` [PATCH v2 3/3] test: efi_bootmgr: add a test case for a short-form path AKASHI Takahiro
2022-05-12 7:02 ` Heinrich Schuchardt
2022-05-12 7:10 ` AKASHI Takahiro [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220512071039.GA88188@laputa \
--to=takahiro.akashi@linaro.org \
--cc=mark.kettenis@xs4all.nl \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox