From patchwork Wed Jun 7 09:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 690181 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp210643wru; Wed, 7 Jun 2023 02:18:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ411IqikWJq3atHVuOerF5TQyYu+G94QECElQMEWX1Z6ju2/A81LgQ+fOTovCJ4Wx8hn3R5 X-Received: by 2002:a05:6808:c4:b0:398:50f1:ad17 with SMTP id t4-20020a05680800c400b0039850f1ad17mr4743593oic.4.1686129537370; Wed, 07 Jun 2023 02:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686129537; cv=none; d=google.com; s=arc-20160816; b=m1MXC9xoM6tKNjfYFxqVDgXoC9omkmUYji2Vqb6D8Mqn8WYHiOi8DEnS7NrVGNDcjX UTBKlYl847bI/9uSujK/9iDLkq+gvMbIUYyHNkJyveDlAPt5RJneo19UxORCoFNh4iV6 KB+h07t3HE8lUzxjSWbjizHeaijNZAGVfZ4Yu45YS7hYIDbbrN0tsYaiUGs0UZi8Bcla kv4lXwYtF12ACslTmgpyxqbGRp7cZnesfpDbTkOCr2g/qGQ7bz5eLQgeCs3ubO46VlQ0 4JeRvoYQldwXCSiRgSN2jAoRrAvnQYHWMWDgoX48muEzfyctWaaBDJWvetmQC078wPyE +iuw== 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=HGAcG+APmSoi8S8Sca75wTj0oiVNRl7K4lV82fxoy48=; b=EgRYXBhjZa7R/DTfyOJRUSoPyG+gIBlErdCnMYMipbb0uNX/Al+U7t/n5cL2w6RuP0 bCBV6ykOzXhWCwh+S0vrvDKFrGiC9Ug1oU7utIsh2twne/b14iwhFp6KE1kyk9swTX26 3Ca4AbKfE1VwvgZ5SONjoNxAkN5hhfIhP/ixFGZQOdaZwXGAAuEN6oLoWmLpPNVN83YC uL3YnYq8fJlmTkPnImYyLXLR7ZrqsU0o6jvrZGNx0Wu1vPWgM9Yu7IrccR5cK6DgsyEZ 7XIIibLenRqzIBrjb50AdC3NyL/ZYXUAtv8jVZ/FAERB9UDw/zW/e4SsHwrPovJLAS2l lcFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WUSBr8Mp; 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 s5-20020a170902ea0500b001b02e044c87si8664071plg.320.2023.06.07.02.18.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 02:18:57 -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=WUSBr8Mp; 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 72AA086071; Wed, 7 Jun 2023 11:18:29 +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="WUSBr8Mp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 74CB88603A; Wed, 7 Jun 2023 11:18:24 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 73FB486005 for ; Wed, 7 Jun 2023 11:18:21 +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=ilias.apalodimas@linaro.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f7378a75c0so29380525e9.3 for ; Wed, 07 Jun 2023 02:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686129501; x=1688721501; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HGAcG+APmSoi8S8Sca75wTj0oiVNRl7K4lV82fxoy48=; b=WUSBr8MpYANeCe/mC0D5UIlUoCsOpEnTltMjM5BQUj8Mjn37WxYSzpjmOshgrFG/NN KmKp+huKMz0vB6aTsIPfls5tGdDXRU+M2oPq2YlZnsnnRqUPlM+93mqrgj/NBePcuNr0 8/Bo6w0UWWz/dMMRYPnZVK9bfDdljlyysh83hYY6ts3FKxvelG8Mm8LBovTIW1+01yRI eCmNWMyKCVGbRIj/PsbGQymY17UjwVEEZwy84Ww6E85cemhkiOhben8J+Fu7Qnez79xe 5G0EiEpDFogwTMhskOSys/DYfjFc1viMqpVmQqHWC2mqv55SS3XNiwwfROgi3BxSCdfz 5oyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686129501; x=1688721501; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HGAcG+APmSoi8S8Sca75wTj0oiVNRl7K4lV82fxoy48=; b=RDnzLmc6HjQw56mOudFd1g3+sZyrDXguA6zuHFa7fCSg/6PjojWXzsKo8F1DZZeh7N N2TCg+cdTzh4BOWSwNpwnvXbTOtqnafd/xSYbijirsXOqVbO8GQI2vnCrtCU0kojlcDE yaJN8vKecxLDi6VXHDRap7yAWKS+2ENC3NVmjzdmArlcxxHFQ05Bb+O+5/DmKJdkIjo8 LW4U0HtkOPWmpKxHdQrd0k2MWmtTniBsPZPokEPhu1XhamUqT7V1Ki0VyD3SoKcDaPuI ddd07NwpUDdWncVEU672wS2l6LEFfzaerDtxiZvD/wmLg0jAsSXoFPJo2kl+4zavXx5s TiRA== X-Gm-Message-State: AC+VfDzhI2qqByiz2a8/zl+5Nuq+7/kzXxdWKAzF/TANQOl3b93R51kN GQnFj9WrKruggs6NUzOqSVCecHSeWPHcjqLvMY1Y0Q== X-Received: by 2002:a7b:c7d1:0:b0:3f6:683:628b with SMTP id z17-20020a7bc7d1000000b003f60683628bmr4177248wmk.3.1686129500928; Wed, 07 Jun 2023 02:18:20 -0700 (PDT) Received: from localhost.localdomain (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003f50d6ee334sm454569wmc.47.2023.06.07.02.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 02:18:20 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass Subject: [PATCH 2/3 v2] test/py: replace 'tpm2 init, startup, selftest' sequences Date: Wed, 7 Jun 2023 12:18:11 +0300 Message-Id: <20230607091812.1916435-3-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230607091812.1916435-1-ilias.apalodimas@linaro.org> References: <20230607091812.1916435-1-ilias.apalodimas@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.8 at phobos.denx.de X-Virus-Status: Clean Instead of copy pasting the commands needed to start a TPM consisting of: - tpm init - tpm startup TPM2_SU_CLEAR - tpm2 self_test full use the newly added 'autostart' which does the same thing and simplify our python scripts Signed-off-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since v1: None test/py/tests/test_tpm2.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) -- 2.39.2 diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py index d2ad6f9e73c0..1ade66a7eda4 100644 --- a/test/py/tests/test_tpm2.py +++ b/test/py/tests/test_tpm2.py @@ -41,11 +41,9 @@ def force_init(u_boot_console, force=False): skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False) if skip_test: pytest.skip('skip TPM device test') - output = u_boot_console.run_command('tpm2 init') + output = u_boot_console.run_command('tpm2 autostart') if force or not 'Error' in output: u_boot_console.run_command('echo --- start of init ---') - u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR') - u_boot_console.run_command('tpm2 self_test full') u_boot_console.run_command('tpm2 clear TPM2_RH_LOCKOUT') output = u_boot_console.run_command('echo $?') if not output.endswith('0'): @@ -83,20 +81,13 @@ def tpm2_sandbox_init(u_boot_console): This allows all tests to run in parallel, since no test depends on another. """ u_boot_console.restart_uboot() - u_boot_console.run_command('tpm2 init') + u_boot_console.run_command('tpm2 autostart') output = u_boot_console.run_command('echo $?') assert output.endswith('0') skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False) if skip_test: pytest.skip('skip TPM device test') - u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR') - output = u_boot_console.run_command('echo $?') - assert output.endswith('0') - - u_boot_console.run_command('tpm2 self_test full') - output = u_boot_console.run_command('echo $?') - assert output.endswith('0') @pytest.mark.buildconfigspec('cmd_tpm_v2') def test_tpm2_sandbox_self_test_full(u_boot_console):