From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7274C48BDF for ; Tue, 22 Jun 2021 12:25:41 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F277E61001 for ; Tue, 22 Jun 2021 12:25:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F277E61001 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48AC082024; Tue, 22 Jun 2021 14:25:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="EJ6OuN4f"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9469F8296A; Tue, 22 Jun 2021 07:49:35 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20623.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::623]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1DFEA82958 for ; Tue, 22 Jun 2021 07:49:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tkarthik@xilinx.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=geHybtbxA87uUY0+JkixoFO0zTQZWtJrg87oUs2eJTdeL9Yk1ZZGhQsdMw8gg/3zipbY8T189TUQSb/cEa2w2rQmIDG3ecKuh8djYcj730qiUHel7Lm00kroQqu8Pu0g/FQ8VRyvMffZ4sAKGDf/tbcIq0n7qQPRhG+h830FpZM6XS4DOcUc9RKwNesAJuuvhJQQyoE9OC66shaBl2GsdXHNY2+BEVvNqoltYGFBgmXsJlB+d6jcihaxM5EN4kbg5sBMuZW1Cw5RGxCB6Eeaajs6fiwSGWexzj0xZXDKccDLvDEcyVdBYZEYDWZcvDejNes/ZjfkACE0cYsxtvNlDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LPXc2qMIodxOvpPVIq0YB1clw6ZJpKejRAg7zMEZ9cI=; b=V6tTcI5lU0zQ3DhlqoAOUqTg5ZYv0iLt0o/W42w+Ek172ty/N7scNf8ryWJ5qKEPvveKvjkUdGTqbN6GlOZg3d5SjM+EwGLa3tt9dZaI9/naAATTf6dBzh52SQaddShAJ82aPQGMT6SqtqOlCOS5xJp9cyvnvjWY4n5SIIfp9+PrU8y1ljxgxVF2EbcGSLWyGNb0HgpPonm8rtXRiHc4SuXsQeNBZmxJTFOQlcu8dtlANKBZ/yj027i5VUXXLpEOIS8NYSGbwlBIAufPLrbPawPz9KpeUglEiZrEsgWtmUB0QjB7qywJPkpsWejcrKqVNZNMgpwif6CCNDlrkN83hQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LPXc2qMIodxOvpPVIq0YB1clw6ZJpKejRAg7zMEZ9cI=; b=EJ6OuN4fhxsQDTp2h/Bu01pO5fQ7+ZPpGAa2dhmRMc9+nN5P1/ks5ft7cpS8CkqFihBAmAS5CnQap+6uMalpdjdHjYBB+qyDUFv/1uHsE9HV+cRFh62dv4Tr5QfpnquanCrdmjWWJTFnvfkLeBCbb+uicLwkJxugkWilRlSb9FM= Received: from SN4PR0501CA0145.namprd05.prod.outlook.com (2603:10b6:803:2c::23) by BY5PR02MB7076.namprd02.prod.outlook.com (2603:10b6:a03:236::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.21; Tue, 22 Jun 2021 05:49:29 +0000 Received: from SN1NAM02FT0042.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2c:cafe::c5) by SN4PR0501CA0145.outlook.office365.com (2603:10b6:803:2c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.9 via Frontend Transport; Tue, 22 Jun 2021 05:49:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0042.mail.protection.outlook.com (10.97.4.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4242.16 via Frontend Transport; Tue, 22 Jun 2021 05:49:28 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 21 Jun 2021 22:49:28 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 21 Jun 2021 22:49:28 -0700 Envelope-to: u-boot@lists.denx.de Received: from [172.23.64.106] (port=33817 helo=xhdvnc125.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lvZHq-0006Vw-5n; Mon, 21 Jun 2021 22:49:26 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 31500) id 63B6C12154E; Tue, 22 Jun 2021 11:19:25 +0530 (IST) From: T Karthik Reddy To: CC: , T Karthik Reddy Subject: [PATCH] test/py: tpm2: Skip tpm pytest based on env variable Date: Tue, 22 Jun 2021 11:19:22 +0530 Message-ID: <1624340962-91190-1-git-send-email-t.karthik.reddy@xilinx.com> X-Mailer: git-send-email 2.1.1 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c5b93ce-3bcc-48bd-739d-08d93541800c X-MS-TrafficTypeDiagnostic: BY5PR02MB7076: X-Microsoft-Antispam-PRVS: Content-Transfer-Encoding: quoted-printable X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mnQcRmnfWlL5xJNjA9KnFNGqBOEOuim+8z71BrdQdpCyEwLfHvm86lbXBIxhcZrwQ66Qx/ATrEgN/NrpgomeN/RTH1rJKNR3PdKVmFzhblPKgwD1iPO2U/8eULlz4dK5ZnwP6+P/EBTV/xpE3wbIizPErMiIfsy8qjKaFnlaam49JvjJ08l0Ya/qVpbTZRzk+OTYTEZY++EDMY/QN74ckZ/hk+fOJvzNGIhNgpudUnHhF7i2vGrUNa+Fyf9cIejJphSvsNxi91EYlCl2hb/eezzF/5DKwGiHD1Df1j39p/9mtOZpEUA95CtWDSSH6H/75xHOJltDDWLm1E2q4r3k0lYvfhgxaGNhwRUNGqmBC7oHSLvptFoaUg8+xW+JjtsWSPu48Q4J3SR1mfSnLBAZjgx84pd2Jivvx3ZHahYmIso2qHImx4QCzcT0P7DpsQ/l/CY90/6FRQk+n+5QRM1aPZkpefcxwwYrkQHG49v+HliI4B4mpATSmnGS/CzAnrjJeoDZNgE02EuiD0X4WrRqQMRmdI/zps+rL0LFTVuV2uKwqELv5ei+b06YccE060tUn4iXX90ww1OHX3JeYDDO8DlAe8zP8utnSykqzkJmh8OOGRNHatuwe6u2xjEOPhJI7tE1lR2V0cpOA/i3N/m2ebmg27K3Au/zabwPrXq6aKWODn1F2/cx2MnG+fIbnQLK X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(376002)(136003)(39850400004)(396003)(46966006)(36840700001)(70206006)(186003)(70586007)(26005)(2616005)(426003)(336012)(5660300002)(83380400001)(107886003)(478600001)(82310400003)(2906002)(47076005)(8936002)(6666004)(356005)(54906003)(82740400003)(7636003)(36860700001)(8676002)(36756003)(316002)(42186006)(36906005)(6266002)(4326008)(6916009)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2021 05:49:28.6282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c5b93ce-3bcc-48bd-739d-08d93541800c X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0042.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB7076 X-Mailman-Approved-At: Tue, 22 Jun 2021 14:25:23 +0200 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 Tpm test cases relies on tpm device setup. Provide an environment variable "env__tpm_device_test_skip =3D True" to skip the test case if tpm device is not present. Only needed will have to add variable to the py-test framework. Test runs successfully even this variable is absent. Signed-off-by: T Karthik Reddy --- test/py/tests/test_tpm2.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py index 70f906da51..bb147d4e88 100644 --- a/test/py/tests/test_tpm2.py +++ b/test/py/tests/test_tpm2.py @@ -18,6 +18,15 @@ any password. * Commands like pcr_setauthpolicy and pcr_resetauthpolicy are not implemen= ted here because they would fail the tests in most cases (TPMs do not implemen= t them and return an error). + + +Note: +This test doesn't rely on boardenv_* configuration value but can change te= st +behavior. + +* Setup env__tpm_device_test_skip to True if tests with TPM devices should= be +skipped. + """ updates =3D 0 @@ -29,6 +38,9 @@ def force_init(u_boot_console, force=3DFalse): twice will spawn an error used to detect that the TPM was not reset an= d no initialization code should be run. """ + skip_test =3D u_boot_console.config.env.get('env__tpm_device_test_skip= ', False) + if skip_test: + pytest.skip('skip TPM device test') output =3D u_boot_console.run_command('tpm2 init') if force or not 'Error' in output: u_boot_console.run_command('echo --- start of init ---') @@ -44,6 +56,10 @@ def force_init(u_boot_console, force=3DFalse): def test_tpm2_init(u_boot_console): """Init the software stack to use TPMv2 commands.""" + skip_test =3D 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 init') output =3D u_boot_console.run_command('echo $?') assert output.endswith('0') @@ -55,6 +71,9 @@ def test_tpm2_startup(u_boot_console): Initiate the TPM internal state machine. """ + skip_test =3D 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 =3D u_boot_console.run_command('echo $?') assert output.endswith('0') @@ -66,6 +85,9 @@ def test_tpm2_self_test_full(u_boot_console): Ask the TPM to perform all self tests to also enable full capabilities= . """ + skip_test =3D 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 self_test full') output =3D u_boot_console.run_command('echo $?') assert output.endswith('0') @@ -78,6 +100,9 @@ def test_tpm2_continue_self_test(u_boot_console): to enter a fully operational state. """ + skip_test =3D 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 self_test continue') output =3D u_boot_console.run_command('echo $?') assert output.endswith('0') @@ -95,6 +120,9 @@ def test_tpm2_clear(u_boot_console): PLATFORM hierarchies are also available. """ + skip_test =3D 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 clear TPM2_RH_LOCKOUT') output =3D u_boot_console.run_command('echo $?') assert output.endswith('0') -- 2.17.1 This email and any attachments are intended for the sole use of the named r= ecipient(s) and contain(s) confidential information that may be proprietary= , privileged or copyrighted under applicable law. If you are not the intend= ed recipient, do not read, copy, or forward this email message or any attac= hments. Delete this email message and any attachments immediately.