All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH v5 17/17] test/py: add a test for uefi firmware update capsule of raw image
Date: Mon, 31 Aug 2020 14:15:15 +0900	[thread overview]
Message-ID: <20200831051515.GB751239@laputa> (raw)
In-Reply-To: <17a3713c-3bae-7cbf-269f-d46424938946@gmx.de>

On Fri, Aug 28, 2020 at 06:07:10AM +0200, Heinrich Schuchardt wrote:
> On 8/3/20 7:43 AM, AKASHI Takahiro wrote:
> > The test can run on sandbox build and it attempts to execute a firmware
> > update via a capsule-on-disk, using a raw image capsule,
> > CONFIG_EFI_CAPSULE_RAW.
> >
> > To run this test successfully, you need configure U-Boot specifically;
> > See test_capsule_firmware.py for requirements, and hence it won't run
> > on Travis CI.
> >
> 
> git format-patch results in the same filename for patch 16 and 17.

Indeed, though the preceding index number will make them distinguishable.

> You subject lines are simply too long. How about:
> 
> "test/py: test for raw image capsule"

Okay, something like that.

-Takahiro Akashi

> Best regards
> 
> Heinrich
> 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  test/py/tests/test_efi_capsule/conftest.py    |  3 +
> >  .../test_efi_capsule/test_capsule_firmware.py | 63 +++++++++++++++++++
> >  2 files changed, 66 insertions(+)
> >
> > diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py
> > index 4e7c36f04ba5..4544a24d5351 100644
> > --- a/test/py/tests/test_efi_capsule/conftest.py
> > +++ b/test/py/tests/test_efi_capsule/conftest.py
> > @@ -51,6 +51,9 @@ def efi_capsule_data(request, u_boot_config):
> >          check_call('cd %s; %s/tools/mkeficapsule --fit uboot_bin_env.itb --version 1 --index 1 Test01' %
> >                     (data_dir, u_boot_config.build_dir),
> >                     shell=True)
> > +        check_call('cd %s; %s/tools/mkeficapsule --raw u-boot.bin.new --version 1 --index 1 Test02' %
> > +                   (data_dir, u_boot_config.build_dir),
> > +                   shell=True)
> >
> >          # Create a disk image with EFI system partition
> >          check_call('virt-make-fs --partition=gpt --size=+1M --type=vfat %s %s' %
> > diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware.py b/test/py/tests/test_efi_capsule/test_capsule_firmware.py
> > index 1673a4877778..2b2c7baa7ba6 100644
> > --- a/test/py/tests/test_efi_capsule/test_capsule_firmware.py
> > +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware.py
> > @@ -15,6 +15,7 @@ from defs import *
> >
> >  @pytest.mark.boardspec('sandbox')
> >  @pytest.mark.buildconfigspec('efi_capsule_firmware_fit')
> > + at pytest.mark.buildconfigspec('efi_capsule_firmware_raw')
> >  @pytest.mark.buildconfigspec('efi_capsule_on_disk')
> >  @pytest.mark.buildconfigspec('dfu')
> >  @pytest.mark.buildconfigspec('dfu_sf')
> > @@ -176,3 +177,65 @@ class TestEfiCapsuleFirmwareFit(object):
> >                  'sf read 4000000 150000 10',
> >                  'md.b 4000000 10'])
> >              assert 'u-boot-env:New' in ''.join(output)
> > +
> > +    def test_efi_capsule_fw3(
> > +            self, u_boot_config, u_boot_console, efi_capsule_data):
> > +        """
> > +        Test Case 3 - Update U-Boot on SPI Flash, raw image format
> > +                      0x100000-0x150000: U-Boot binary (but dummy)
> > +        """
> > +        # "-T" (or "-D") is required to enable spi flash on sandbox
> > +        u_boot_console.restart_uboot_with_flags('-T')
> > +
> > +        disk_img = efi_capsule_data
> > +        with u_boot_console.log.section('Test Case 3-a, before reboot'):
> > +            output = u_boot_console.run_command_list([
> > +                'host bind 0 %s' % disk_img,
> > +                'efidebug boot add 1 TEST host 0:1 /helloworld.efi ""',
> > +                'efidebug boot order 1',
> > +                'env set -e -nv -bs -rt OsIndications =0x0000000000000004',
> > +                'env set dfu_alt_info sf 0:0=u-boot-bin raw 0x100000 0x50000\;u-boot-env raw 0x150000 0x200000',
> > +                'env save'])
> > +
> > +            # initialize content
> > +            output = u_boot_console.run_command_list([
> > +                'sf probe 0:0',
> > +                'fatload host 0:1 4000000 %s/u-boot.bin.old' % CAPSULE_DATA_DIR,
> > +                'sf write 4000000 100000 10',
> > +                'sf read 5000000 100000 10',
> > +                'md.b 5000000 10'])
> > +            assert 'Old' in ''.join(output)
> > +
> > +            # place a capsule file
> > +            output = u_boot_console.run_command_list([
> > +                'fatload host 0:1 4000000 %s/Test02' % CAPSULE_DATA_DIR,
> > +                'fatwrite host 0:1 4000000 %s/Test02 $filesize' % CAPSULE_INSTALL_DIR,
> > +                'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR])
> > +            assert 'Test02' in ''.join(output)
> > +
> > +        # reboot
> > +        u_boot_console.restart_uboot_with_flags('-T')
> > +
> > +        capsule_early = u_boot_config.buildconfig.get(
> > +            'config_efi_capsule_on_disk_early')
> > +        with u_boot_console.log.section('Test Case 3-b, after reboot'):
> > +            if not capsule_early:
> > +                output = u_boot_console.run_command_list([
> > +                    'host bind 0 %s' % disk_img,
> > +                    'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR])
> > +                assert 'Test02' in ''.join(output)
> > +
> > +                # need to run uefi command to initiate capsule handling
> > +                output = u_boot_console.run_command(
> > +                    'env print -e -all Capsule0000')
> > +
> > +            output = u_boot_console.run_command_list([
> > +                'host bind 0 %s' % disk_img,
> > +                'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR])
> > +            assert 'Test02' not in ''.join(output)
> > +
> > +            output = u_boot_console.run_command_list([
> > +                'sf probe 0:0',
> > +                'sf read 4000000 100000 10',
> > +                'md.b 4000000 10'])
> > +            assert 'u-boot:New' in ''.join(output)
> >
> 

  reply	other threads:[~2020-08-31  5:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  5:43 [PATCH v5 00/17] efi_loader: add capsule update support AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 01/17] dfu: rename dfu_tftp_write() to dfu_write_by_name() AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 02/17] dfu: modify an argument type for an address AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 03/17] common: update: add a generic interface for FIT image AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 04/17] dfu: export dfu_list AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 05/17] efi_loader: add option to initialise EFI subsystem early AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 06/17] efi_loader: add efi_create_indexed_name() AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 07/17] efi_loader: define UpdateCapsule api AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 08/17] efi_loader: capsule: add capsule_on_disk support AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 09/17] efi_loader: capsule: add memory range capsule definitions AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 10/17] efi_loader: capsule: support firmware update AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 11/17] efi_loader: add firmware management protocol for FIT image AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 12/17] dfu: add dfu_write_by_alt() AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 13/17] efi_loader: add firmware management protocol for raw image AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 14/17] cmd: add "efidebug capsule" command AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 15/17] tools: add mkeficapsule command for UEFI capsule update AKASHI Takahiro
2020-08-28  3:58   ` Heinrich Schuchardt
2020-08-31  4:54     ` AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 16/17] test/py: add a test for uefi firmware update capsule of FIT image AKASHI Takahiro
2020-08-31 11:44   ` Heinrich Schuchardt
2020-09-01  5:20     ` AKASHI Takahiro
2020-08-03  5:43 ` [PATCH v5 17/17] test/py: add a test for uefi firmware update capsule of raw image AKASHI Takahiro
2020-08-28  4:07   ` Heinrich Schuchardt
2020-08-31  5:15     ` AKASHI Takahiro [this message]
2020-08-31 11:45     ` Heinrich Schuchardt
2020-08-17 10:42 ` [PATCH v5 00/17] efi_loader: add capsule update support Heinrich Schuchardt
2020-08-25  5:42 ` AKASHI Takahiro
2020-08-31  4:32   ` AKASHI Takahiro
2020-08-31 20:15     ` Tom Rini

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=20200831051515.GB751239@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.