From patchwork Thu Oct 7 06:23:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515436 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp1004743ime; Wed, 6 Oct 2021 23:26:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEuSlokw5QjbBHKvFxqiosRtLrk1MLEDjLKAq8POJOtpmrnP8Y9TPkt6bwIU/etzUftdCh X-Received: by 2002:a17:906:2a0d:: with SMTP id j13mr3184329eje.545.1633588011649; Wed, 06 Oct 2021 23:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633588011; cv=none; d=google.com; s=arc-20160816; b=udWF95W67R3zDtuGs1HIuAw+LfWXWWGoSPq6sk4Suv6UQu3mMuNvWiQrhCqZB0Z/gd 9WdjQHqMmLEx6psJqnb+Kwd5KG0xHBFp1jUAubKOyn9RPkhj21Zfd2jkWKETrOXgrmeR JLcW/aC7DA4ZmAqWQS+2Quknj8XHN2QbobhVBwjpVhm/rPBaMkkRRg7EipbYCwO2Pjf2 L8TFJGrvfE/b1uhK6muv968AcegPenXk7+hvfFYyB0tG9WhhVNU7JIIi8xa7CY2gBQV+ PHNqMw9lnqFy7BhvvrT4sFRcqSutbYRM33yXxv1MKXijO4xRkhs6s04qTPaIV08UqwfA bGDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l5K7bZA1xCRJEeBfnbGKk5pon0Oo+koRPhH/3diNvjk=; b=0yDJa/1I26PRVkYEl1qVsmw07OPXhHlWOO3qldqQEhGhJfjA3WyupSpQijPftfiSRn B7S6t1XDxbwxy6wGbIfguwDCp76GbOzQP9zahzFZAYiWy1U3i2We8bDfIYqHVD2xfjvI eViO0aJbEe7JxUw+3I/TF46a507wQ4NIXEpOtr0m28ovl52pe4fxCMzCDkxIF+kcT/gS uq92eu+IWgUason71bzKSzR2iFCO8+oh/TVjlFc0+EMHUo7jyKh4LiAnKPCWj1E1KYRX BSiskn/e1lkOLY1yDM6zUUxYDK4j1BnJoDnOKQmnQQjq7oHlp+rLc/4guRxd/EmFGws4 zXTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YIni2OGz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f13si42222208edf.345.2021.10.06.23.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 23:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YIni2OGz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D1E083462; Thu, 7 Oct 2021 08:25:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YIni2OGz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D8739834DA; Thu, 7 Oct 2021 08:25:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8A6CB834D1 for ; Thu, 7 Oct 2021 08:25:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x42b.google.com with SMTP id m14so4441553pfc.9 for ; Wed, 06 Oct 2021 23:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l5K7bZA1xCRJEeBfnbGKk5pon0Oo+koRPhH/3diNvjk=; b=YIni2OGzhkiSB+i2meKFJIySHMlJbEyWpKjzj/6KWFml/dFze0YGi7v2nCwRKFO8+T K7xyzjXnflfebtCii0Z4peLAoUI9puWjtOiKYkeC4mVPDuOzN1uFNGShAy7ifuQuSCUu MtzOteQ9CL0kF5DIHvDDZotZt8K8nyQwKTflEIKTMcSnfKcvv48g4qXkpnKdSOAA9R14 lp+4zixlLCnRtVyPd5QgQ/PmbX2JfLbB85H/gPEG1T6m/jY1Rv/zG1+o9Oah4061JcLE YJbxeM3U1+0T1g6gIF042Tgfc7tRSUc83Mo51lWlWB2iaOb8YqHWTMilbScM4hJmG/SX GqbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l5K7bZA1xCRJEeBfnbGKk5pon0Oo+koRPhH/3diNvjk=; b=BTHU4Eez1zW+0xJig3pUmg8fWqQCe4sGuMUnxgvSM2S7NMw8zMtWuHoZgJ02Lo31la SkeUuUHt4hzb4PB9Y+TvPU95zYi/mCAr5X2+g062bgzbvYZCste6Uk5zewbpIblX2C12 NcnmM9SKZ1FjJfuRO/xCm0p4zvgfToqnRXA2c5VEF2GC2/NOtZcZFJ6Ijvh6AunckYcM nA7RmMzSc6gR5UCRpAnrfPVy3OU3fbVs/7wWB9b+U/oUuLORiwRWneb5oQ60vWeQuBAx jL02SnRACu0Vg3mplQrd2y9YCXSP7hO/oaGDquVfNK9DRePhYdVmX11KOM4Kvds2cr9E cUfg== X-Gm-Message-State: AOAM531UdXyPwK1PsI23pTv5KI/rn+0YPm5W76m47yFNpYXg0m8zSmzW ShaRIVhksRpEE+l5ZcZSsXg0lQ== X-Received: by 2002:a62:b50d:0:b0:44c:7488:e593 with SMTP id y13-20020a62b50d000000b0044c7488e593mr2565456pfe.59.1633587940865; Wed, 06 Oct 2021 23:25:40 -0700 (PDT) Received: from localhost.localdomain (122-100-26-39m5.mineo.jp. [122.100.26.39]) by smtp.gmail.com with ESMTPSA id b17sm22131859pgl.61.2021.10.06.23.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 23:25:40 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v4 10/11] test/py: efi_capsule: add a test for "--guid" option Date: Thu, 7 Oct 2021 15:23:39 +0900 Message-Id: <20211007062340.72207-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211007062340.72207-1-takahiro.akashi@linaro.org> References: <20211007062340.72207-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean This test scenario tests a new feature of mkeficapsule, "--guid" option, which allows us to specify FMP driver's guid explicitly at the command line. Signed-off-by: AKASHI Takahiro --- test/py/tests/test_efi_capsule/conftest.py | 3 + .../test_efi_capsule/test_capsule_firmware.py | 67 +++++++++++++++++++ 2 files changed, 70 insertions(+) -- 2.33.0 diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 8b5368c11abc..cd750347879e 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -56,6 +56,9 @@ def efi_capsule_data(request, u_boot_config): check_call('cd %s; %s/tools/mkeficapsule --index 1 --raw u-boot.bin.new Test02' % (data_dir, u_boot_config.build_dir), shell=True) + check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid E2BB9C06-70E9-4B14-97A3-5A7913176E3F u-boot.bin.new Test03' % + (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 9eeaae27d626..9cc973560fa1 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware.py @@ -247,3 +247,70 @@ class TestEfiCapsuleFirmwareFit(object): 'sf read 4000000 100000 10', 'md.b 4000000 10']) assert 'u-boot:New' in ''.join(output) + + def test_efi_capsule_fw4( + self, u_boot_config, u_boot_console, efi_capsule_data): + """ + Test Case 4 - Test "--guid" option of mkeficapsule + The test scenario is the same as Case 3. + """ + disk_img = efi_capsule_data + with u_boot_console.log.section('Test Case 4-a, before reboot'): + output = u_boot_console.run_command_list([ + 'host bind 0 %s' % disk_img, + 'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""', + '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/Test03' % CAPSULE_DATA_DIR, + 'fatwrite host 0:1 4000000 %s/Test03 $filesize' % CAPSULE_INSTALL_DIR, + 'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR]) + assert 'Test03' in ''.join(output) + + # reboot + u_boot_console.restart_uboot() + + capsule_early = u_boot_config.buildconfig.get( + 'config_efi_capsule_on_disk_early') + with u_boot_console.log.section('Test Case 4-b, after reboot'): + if not capsule_early: + # make sure that dfu_alt_info exists even persistent variables + # are not available. + output = u_boot_console.run_command_list([ + 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"', + 'host bind 0 %s' % disk_img, + 'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR]) + assert 'Test03' in ''.join(output) + + # need to run uefi command to initiate capsule handling + output = u_boot_console.run_command( + 'env print -e Capsule0000') + + output = u_boot_console.run_command_list(['efidebug capsule esrt']) + + # ensure that EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID is in the ESRT. + assert 'E2BB9C06-70E9-4B14-97A3-5A7913176E3F' in ''.join(output) + + output = u_boot_console.run_command_list([ + 'host bind 0 %s' % disk_img, + 'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR]) + assert 'Test03' 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)