Received: by 2002:a17:90a:bc8d:0:0:0:0 with SMTP id x13csp1496572pjr; Mon, 18 May 2020 14:41:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyklB8Xqplw+N/dFjOS56cPjmqCldCPsQOioOAjAqV29lEm6abCkU92DKo/sUsx1NyeXOcz X-Received: by 2002:a05:6402:1447:: with SMTP id d7mr10318974edx.367.1589838107067; Mon, 18 May 2020 14:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589838107; cv=none; d=google.com; s=arc-20160816; b=SXXsPqhqRr8xKjNcT3+3iuY7MVX2+te0FOIMK7DY+/2j3BgP8Sp2wIf2cN0Qn/CEQ3 IVouAcrsoDkZf7cWzRqwSveeUf7W24cSAZB6Oqaaty7FrTNeCz/0By+xW474Z7LzNwhW isET/rmDpEZI9Bwp7wP7klO34KE2hTHae5QnD8izTIYRytq+ycRcpUBI2F4DFKxwOd7T ibyfhnn74J2GDBrr3wccoe6ABtVVa4n3QoFOHJm5zJvs8N0+Z+4Z+7zD0aEEJNDuQsH8 yVC+OpcyvYbfSLpEOZW88w0L1x1QQLsuxkKG6QMJ9DuPAr3Guw796Ns1gd0fH1QUnHA0 a8LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Dx/X3SaYQEqDKoT7rh+jjl5MaNmPt6X/qdvyrMk4uio=; b=oEjcSWsJ8nC8gH5gJxmK4kAZhZ90Q/2AL+KNgl5bctz3cRSulP1wFo3t/pH5VuRWwF vopcZJIATCZbsNtH8bj7lyedL0Bcty4YQCl15jBpQ+fgz9XCAw7y/cpQZyZsmy12E6Gk ZxOh8yPXFYn6nymHR33GuACHuMSB7LZ62vaVV9rEHm/+yzc7paWd73O2WX/AcI9f9WHj P4039SuJNOECX3tZ+J2zp79xlhpLZr/dydvJhf8fKWXSc736U08K5WfNNmUP4Bf6mBij 7VATFwxbcWm1BgK+tWC2OFU0LHdEsDkzFBtQRKsL6LplFspv7og9kdO797t6U9Wlczm9 sKgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=LmW2zV3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si7455850edb.81.2020.05.18.14.41.25; Mon, 18 May 2020 14:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=LmW2zV3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728129AbgERVjr (ORCPT + 99 others); Mon, 18 May 2020 17:39:47 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:56542 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbgERVjr (ORCPT ); Mon, 18 May 2020 17:39:47 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id ACEBE400B9; Mon, 18 May 2020 21:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1589837987; bh=4fUtfqcSwPxDzsZvtjaryhdzMyuy3jPIOnsb1fo4TLE=; h=From:To:Cc:Subject:Date:From; b=LmW2zV3vqgfLtNGu6lM/+d6Fcr3odAXOx1mpOrnSof+11mW/l74QsXtnwaTKqce9I uDfdtMdKwe41oYXsqdZgX2SD0Pt+TD0U10To7eG4t7BDtNNc78sghfN7RvlILSFyJA ipdKw2/UhZezG/b79Qf8ZZgqxINOkOsFKCRm7ErvyHtxdlelaiBCOJr6pun9ta1oB8 oKuFMJbWK5n+KYL5DCdxFI7aI204vdNIL5AJ9AFpSgfGtbwZ8l0LXZIMkFwAtWPClX QJ/5xREN94OsXPYjk1KNCgXFNUJxtcYe9bB4UPuZ5U2UHy/tkR6wUDz4FSS8rmy0Jb qO/QgEz8NjF2Q== Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 2B482A005C; Mon, 18 May 2020 21:39:37 +0000 (UTC) From: Nikita Sobolev To: Shuah Khan , linux-kselftest@vger.kernel.org Cc: Jarkko Sakkinen , Tadeusz Struk , Joey Pabalinas , Petr Vorel , linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, Jason Gunthorpe , Peter Huewe , Alexey Brodkin , Eugeniy Paltsev , linux-snps-arc@lists.infradead.org, Nikita Sobolev Subject: [PATCH] Kernel selftests: Add check if tpm devices are supported Date: Tue, 19 May 2020 00:39:34 +0300 Message-Id: <20200518213934.23156-1-Nikita.Sobolev@synopsys.com> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tpm2 tests set uses /dev/tpm0 and /dev/tpmrm0 without check if they are available. In case, when these devices are not available test fails, but expected behaviour is test to be skipped. Signed-off-by: Nikita Sobolev --- tools/testing/selftests/tpm2/test_smoke.sh | 11 +++++++++-- tools/testing/selftests/tpm2/test_space.sh | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh index 8155c2ea7ccb..e55d3e400666 100755 --- a/tools/testing/selftests/tpm2/test_smoke.sh +++ b/tools/testing/selftests/tpm2/test_smoke.sh @@ -1,8 +1,15 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) -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 a6f5e346635e..180b469c53b4 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.16.2