From patchwork Tue Jan 18 04:39:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 532862 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp3352920imp; Mon, 17 Jan 2022 20:42:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwzOt95rRQdye5mG2+cT+yQ0VyfreR3yDlwQdxVucPQAQGAk4OLEI9rcURCXFnc+rQVqXp X-Received: by 2002:a17:907:9694:: with SMTP id hd20mr19083397ejc.571.1642480928826; Mon, 17 Jan 2022 20:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642480928; cv=none; d=google.com; s=arc-20160816; b=AHvQWHelYWKPIAfdHZPYpPGOos/dzYM/Ka4pDNwwVihm/SrqLWFSWb8TDgWvnZbjlx 5aDAwTTrIyfFzGmZybrKwZP2QERejELeMeObDLbuXeHoaEorlsMeNlY26AewUyjzdJbX qKDkUWpyGamS9Q6UUHx8HU7FN4AXz1Vkhxjndt7XhcbDZH+4nGWoEDTJDBS8zvhJ4kGH 0APjYIFz2Ea6VgFrb1Q0vqnkW18FlLM6iRPI+kzSMHsRZaG8RRs9bsfkLRCgfnOMVJv/ kjlhRtrYruHSd6miXZE2no5jj5ky87iFp6UqdHcsKDavS6Qt6i1QKKFk8frbx6veIxUp KRdg== 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=37b4CbGVq2vXfUQd07BoRyvPsjDtxkfVdV+ImREOVoM=; b=XRa28ykCV2+hiNNJ5QcI/MubPkdgY1ExOLpH3hva3eq8QZ6NRKzBTYHW/CPgw9wGOp PHuFP0UIj17uOagU6lGBQz0+qRorM9jdQCxT0cr8Dhd31fAZ1JBxVNEp/hVWYTxuDPQG W5PFvObnLcgxIILqbo91Z4Wwoppw2S0BlKQK5MpJSdIOHrvmXYzsZe1su1GZwYBhaAMr aFq4OKa/M2Jon+8Qbj+I+BdA5Yhv8+i/AANiIjdJeZouwfB2boXh7mXWgrUPKJyzo+Br Pw3Jy7YB1kxgn2/aeQyYZwHFX70e2XBDIwvtPASfC8ClH9+8JbB0vtDTyw5MTiN43mv6 29SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G4oN1NzG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id c20si9642424ede.538.2022.01.17.20.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 20:42:08 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G4oN1NzG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 8A541837FD; Tue, 18 Jan 2022 05:41:13 +0100 (CET) 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="G4oN1NzG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 271E0837F6; Tue, 18 Jan 2022 05:40:56 +0100 (CET) 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-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (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 58620837F0 for ; Tue, 18 Jan 2022 05:40:49 +0100 (CET) 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-x436.google.com with SMTP id r5so4895608pfl.2 for ; Mon, 17 Jan 2022 20:40:49 -0800 (PST) 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=37b4CbGVq2vXfUQd07BoRyvPsjDtxkfVdV+ImREOVoM=; b=G4oN1NzGHNFxzxRjmTiFvdnSRh8atk5pxU1L+mxlZLy8gv404sTSnmAycbpi6IO1dJ rA+zGChhxHztvZ/18v4XeNPmly6qYu44Ixj8o9L0p9M6Ma1/nNDIHGqxoHP8GDsjOa78 Mcli00ttvR71nt5BfvKtNzEsaeJX6SQA4YkFHBt/x2kL4hOpXlqNV75Zi6cFT1DuxNNK 1mwY5J+dLOycAslVawb3BMv1+q4yfRW5aeqddEZujMZmazN/B2ciL3iaCJhEY+7cFHjE B2uCCEQy1NOYYYajUgoUkOV+ITMxDro8bzpRAHl8hTsyWUWRPNIIdcNcP+pWvhDIJZgQ 10zg== 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=37b4CbGVq2vXfUQd07BoRyvPsjDtxkfVdV+ImREOVoM=; b=iaW/vfQ/zGkj22+l9LeeKKiNL1YrAKzaJQGXkDwEbngWXpz8LXQ+ZElncxa505Ijkc o+Q0wgyZyRp+IY7YRy6t/J6o6syplYEOeBvUOThLyZ+TwSLIOrHSWZ+xMJY7Egih6QOj CAXa6yLZ7Fn8mJDAcUX+TOnuShdP+FccOW9phHqLEZEnFIH+oZdZLhsJZN5uNB1+tv/J MqtQQkAeEK88hxRKiKv7hKEE6+aegp426hBX/ll1sGu1SCkqC1IvtkW9fM3+umt89bYb DKhQJqxRcUqjaKWlOxdX2ipwWA5kgSgMgpOV6xGEVBq1gDCHnQWTQ/xAl7V1FsTFMFQ8 0U3A== X-Gm-Message-State: AOAM532p8njkNbCE/cpM2SOZQhZ6ggpckX21xyRQsZgPmKYDdTn6n5Nr rRTJL306L7zjo77cL4kk4hm/y1vyc11yiA== X-Received: by 2002:a63:2cd2:: with SMTP id s201mr21733507pgs.53.1642480847691; Mon, 17 Jan 2022 20:40:47 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:bc1a:291e:ac91:be98]) by smtp.gmail.com with ESMTPSA id y69sm15670770pfg.171.2022.01.17.20.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 20:40:47 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, mark.kettenis@xs4all.nl, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v9 10/11] test/py: efi_capsule: add a test for "--guid" option Date: Tue, 18 Jan 2022 13:39:53 +0900 Message-Id: <20220118043954.55940-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220118043954.55940-1-takahiro.akashi@linaro.org> References: <20220118043954.55940-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 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.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(+) diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index a5a25c53dcb4..9076087a12b7 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -86,6 +86,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) if capsule_auth_enabled: # firmware signed with proper key check_call('cd %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)