Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2933857ybf; Mon, 2 Mar 2020 19:03:49 -0800 (PST) X-Google-Smtp-Source: ADFU+vuqOvFFXioiGx7hnF5GdbVZ2ZZq8SZMYGZggyVoc3awwbJUATZkjgdZKU2W6QaZLbMZ1zZ6 X-Received: by 2002:aca:f405:: with SMTP id s5mr1056156oih.93.1583204629033; Mon, 02 Mar 2020 19:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583204629; cv=none; d=google.com; s=arc-20160816; b=djSRnf4ve/xi9F/ES9QNmlNUbVttl6eSRG0rUhNq/F1GxRhKeQzusud00kaxRZTU8x BJd5DaStw02t+ec/3xD5CKSvieHQx/9bqT1z0t3uvbNxpsP7iGtxGAQMlQIRHEaTekw4 Ii74DUfeICo/oT6j7H9a36gBaM01YaE5KuaIItH2TnR+eglqFlY4ehQ/EJgtPKa4gWVV izH/G2Uavzbl8/9NAhQ/pRFlkTyNgnGKZUxvqXGH1X2Iwwl2nQ4ZwQ7LHIMqJxvJbD20 A2AvDxlgBAVfk0rhQf5MPeeTVzXORt0vZb0BJ7vHHYi4Y6P/X4835IK+JZvUco7jPVMC 7H0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GzBbFynfi6byr/7zeZZLhZgKyRPrGKYL7ANBnQtiP8M=; b=n/d23xo9WFcDeyFFO3gdSUxWkmqkPul7jy0iEhYWUACkQjW108e7ZK4pBeck34mlQo ah3PeyfFXwTwDQlTu8IaqGANoJmjcHi+0KU0iX2Ex/nrpFw31NPV/89yhsLIjVrGU5ov lW+Uo037J30ppUi3223UaSe735d177M+JiRelqEdXumim7m9VxfD1YLNOUHMnL9aW365 kK0ZdaHSsu2HY3V/GDq9MXPONDnPJc54M2X/yal3jEk7Fn5MCn5f2WsoEltP8dNHszwO XiX0Ziqon8o1H2DSJtAexbby7XWxi+pkz4Lo0ulltNSLh5HBOaEhCDYdvlKTTj6YASEn NWIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z6oaT39M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si7240615oia.33.2020.03.02.19.03.37; Mon, 02 Mar 2020 19:03:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z6oaT39M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727667AbgCCDDa (ORCPT + 99 others); Mon, 2 Mar 2020 22:03:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:40596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbgCCCqV (ORCPT ); Mon, 2 Mar 2020 21:46:21 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D3C424681; Tue, 3 Mar 2020 02:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583203581; bh=3TigfwXrdUcwuJtxDdM91sunQiw06FIrpMZszuW3/3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6oaT39MqzyUR6VPTFxGStwF3cqMdBRHE620C2HV8khFPWh9PSEfWNXlIEjCFID+K fyk3hTQXMOgMjjkOFVslw9nRLHwzygwO7/IUeu8mAk0f5PWdjJ21uWCPItVNmZV95S Wm8qdN3rK+aHBL0KsTpOykNH+lQtI5SOogVVRoXk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nikita Sobolev , Shuah Khan , Sasha Levin , linux-kselftest@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 04/66] Kernel selftests: tpm2: check for tpm support Date: Mon, 2 Mar 2020 21:45:13 -0500 Message-Id: <20200303024615.8889-4-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200303024615.8889-1-sashal@kernel.org> References: <20200303024615.8889-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nikita Sobolev [ Upstream commit b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc ] tpm2 tests set fails if there is no /dev/tpm0 and /dev/tpmrm0 supported. Check if these files exist before run and mark test as skipped in case of absence. Signed-off-by: Nikita Sobolev Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/tpm2/test_smoke.sh | 13 +++++++++++-- tools/testing/selftests/tpm2/test_space.sh | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh index 8155c2ea7ccbb..b630c7b5950a9 100755 --- a/tools/testing/selftests/tpm2/test_smoke.sh +++ b/tools/testing/selftests/tpm2/test_smoke.sh @@ -1,8 +1,17 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +self.flags = flags -python -m unittest -v tpm2_tests.SmokeTest -python -m unittest -v tpm2_tests.AsyncTest +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + + +if [ -f /dev/tpm0 ] ; then + python -m unittest -v tpm2_tests.SmokeTest + python -m unittest -v tpm2_tests.AsyncTest +else + exit $ksft_skip +fi CLEAR_CMD=$(which tpm2_clear) if [ -n $CLEAR_CMD ]; then diff --git a/tools/testing/selftests/tpm2/test_space.sh b/tools/testing/selftests/tpm2/test_space.sh index a6f5e346635e5..180b469c53b47 100755 --- a/tools/testing/selftests/tpm2/test_space.sh +++ b/tools/testing/selftests/tpm2/test_space.sh @@ -1,4 +1,11 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) -python -m unittest -v tpm2_tests.SpaceTest +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +if [ -f /dev/tpmrm0 ] ; then + python -m unittest -v tpm2_tests.SpaceTest +else + exit $ksft_skip +fi -- 2.20.1