From patchwork Thu Jun 1 06:20:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 687690 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp173108wru; Wed, 31 May 2023 23:21:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4IidE+nO2acuXQquwFL+zt1GWvpUyzvRCXFBkrqa7cc5NgWWmmBhFtn3g8r6Uiv2AQ1BTQ X-Received: by 2002:aca:d18:0:b0:38c:5a32:325b with SMTP id 24-20020aca0d18000000b0038c5a32325bmr6433331oin.41.1685600476822; Wed, 31 May 2023 23:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685600476; cv=none; d=google.com; s=arc-20160816; b=ojScABg8P1KEg91dRpaVmdVXh5a+5aFbNJm3haW++u83JhtMg/EG2QcYJE0j1Znlh8 Nk1PDc1m5ZJJ/TNQW7PXjdg5ER5e4vgWJIb7LjxcydbJpcBmMbdrT9vsioYiEGrk4P5M QheYulqZPnvxgP8UybBksOkQOXk/47Ug2zjFRPFenPMhL3lFnzcQOz/KO2cNOBQjJP0i 4CFE108oFTULiHL+hmrDYMTJRdNZjxmS/HsVtDaWBK9b9B4eolE3IQSTvzqcAI9kA3n1 QcAr6e2Q3F0JEaQwqCDhaz6lzSGGoj/yPvqX3xoUPviTtXG0/SYKuqwEG0K8CHtPd0Hk IfVA== 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=POMN3ed4qtm3mIaJ0zz4mvHUBZE/PYf7hZDaYx1iGN4=; b=l9rml3MFRJzkE3xk/uwrJGCg9mK/2BstBzP5SQBxV3WyqaOO+P39Sfb3BvqW2Y6M+p I9ByB7vCJj0FZY3N+Vl0CAHmjWNFhhrTf8wxvfP2CPXKM0CpN5j8jNs+N2l6PayPHFGN 7vvnsIKe+Ywf/75ozvKuy3eF97Q2wypX4+y0aIIgQJnT/qOJXSkK2ucUEU+oz7qgL/aM 8vQp2Y0pI1Z6uoegzYtXRWDFgdOGbmz/c98CNIrchPTp72d/0zj186a7yA0kSH7CqZ12 v0tlUrZQlUc0EdTHnPg9GUe0xrWNaOJFlFK+hXK6vUiW9tI4uo9KDLCRYi6v44Mv2buw oz6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=biRr2shm; 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 q8-20020a17090311c800b001b02390367fsi1587228plh.595.2023.05.31.23.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 23:21:16 -0700 (PDT) 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=biRr2shm; 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 9BBEA862A1; Thu, 1 Jun 2023 08:20:57 +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="biRr2shm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 87C3186234; Thu, 1 Jun 2023 08:20:53 +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-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 B699086267 for ; Thu, 1 Jun 2023 08:20:50 +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-wr1-x42e.google.com with SMTP id ffacd0b85a97d-30af86a96b4so427114f8f.3 for ; Wed, 31 May 2023 23:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685600450; x=1688192450; 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=POMN3ed4qtm3mIaJ0zz4mvHUBZE/PYf7hZDaYx1iGN4=; b=biRr2shmSqa4pGuiq6zp2uZeisYF6UjuZJ9nDj8huy8QhrI2qPidlcbbohAa+M+2wI g7U9fos3dvxhCRyGc15WNKITBIgocJ4AAcQIHAI/m9iMb5IMyZPh7PClWvpKuk2ox2qD /deRLRSJ+BdRd8RfGOn//idaxzSNwxTk3tHSnZFjjwapkmNfxaEXvIiWRHLaevg3wAPG +XzSqLKcmG5yp8+Efs926KApFNQDAw/XEL3tBsmoHyrn8XfLsuXLyfDYXAa4TXL83QLQ hZQvGYPKRZw6rlR3jHpQdj0ES/xZP4dJ0qeAHAfsZ/wUGVCo31vyswVJR/wsDi8GVl34 +xyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685600450; x=1688192450; 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=POMN3ed4qtm3mIaJ0zz4mvHUBZE/PYf7hZDaYx1iGN4=; b=cRMWPB/ggiLo/M7in2U5M4MfxjD/WEgUNSbRcRy38ZmiqfcgIFTk7rfF+owlCV7lP4 Dkgl0XAYfRzQknOvDgWONjQGwXGPgI6gYVCwxSKQ6ft+JgDKgiQlgPC5yyaQoJ2krQit bemlfzCwNmSKpDl2TPDwDIq0d0/hRAZHVnirAzgW8tNRRbrr3mS2e48bif1pPA3NfCfP AXOfYsv7XeKjHOIDyxGIGD6XfhHIVVrK7taERz9zADxScfj8+LRB/qA/tzWavDIU9H8Y 3pvoQSyYkjvBZjDCykB+WFwFqnqx95G50XlO8u/l5uqGzqL0HVt/6xCQei9fp6DsjJXC nifQ== X-Gm-Message-State: AC+VfDy+W3mHqBou/wEPjl/8S76/+l8jZFYvKky86g8XqQF03qdlzNgA xZugDEy3TQvUdDKR0qHru3N9AVRPC/FREk8oEdc= X-Received: by 2002:a5d:428f:0:b0:30a:f222:5241 with SMTP id k15-20020a5d428f000000b0030af2225241mr914980wrq.14.1685600450174; Wed, 31 May 2023 23:20:50 -0700 (PDT) Received: from localhost.localdomain (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id q7-20020adff507000000b0030add836194sm9087676wro.65.2023.05.31.23.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 23:20:49 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas Subject: [PATCH 2/2] test/py: replace 'tpm2 init, startup, selftest' sequences Date: Thu, 1 Jun 2023 09:20:41 +0300 Message-Id: <20230601062041.524010-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601062041.524010-1-ilias.apalodimas@linaro.org> References: <20230601062041.524010-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 --- test/py/tests/test_tpm2.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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):