Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1475550ybk; Thu, 21 May 2020 07:46:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBreJ84aF6PM7cpw+6mZkjyEbSVr5YQh0ye6fK1geMD5YdZiq7OPAwi1IY2EH8xmmDtPwD X-Received: by 2002:a05:6402:a41:: with SMTP id bt1mr7727317edb.151.1590072385094; Thu, 21 May 2020 07:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590072385; cv=none; d=google.com; s=arc-20160816; b=L00LuMPuZQBAfXVRdaLxOywQkSy5w3MRqGvP5xBH5zEUwE1F0Oh7cq492MrMcxz4hW 4YOGP+bRSZx4CVTO2bep4gu6Nv0dsbqD4Ld17JxzH/9sPngcKCsF8uUkWE9hW7CEAMzy ZLknSZgUZP9y3SXzdchu3CQBzc/FWXO6I1xZ2RqR69YJuwXWal7BZNZ/W4ku5KdDzsOw flJ6e6SBSzDC2PuAgIXmymlCU+4b7+x4tyiN2u5yYtv/kftsqXOyWEeRjbQJN5//TX9l UluzSBB9CIYx87WBjWwEqNFnRMAR10mk0ml0o9FbeBHkxGagvd4DfHJAypOB31wnpXKp HNWg== 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=v4k0TB+uXCXWgxIpcL5JW8+YWTD1BIxtosSxd6AJLk8=; b=PNKPwIqTCoBcu2xz03YHXX/fEQ63+moCY4AJNI8DwT1Wzqeq3dxVY5fl5jezAS19kJ fvGaBzOgc2pF3BWtzN2vh5JS3k102xSf19BBR+VOLxaVMjPx2awC2SFRgVS9MIHg8u0Y JvIL4Pk+WEJ8JzHyACLKSdUPpTw+Z+cB0LAg/GEAsTBjtGcb+KynKBRS6R9KEAKalx6g qIQVFng/ul5t973Anl8FupxoRIL7ESTqQ35nx6n1h5XJd3rbYmQPVdDevuwiPw0JeRqs ESOK4hNLqK33JofcvtU08uzCkPp/bldXhS1RGN/y3NRmrdyuGOQ2cQgX1uK4WJZM6cvN GxCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=MbNJli3r; 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 a24si3511893ejg.46.2020.05.21.07.46.01; Thu, 21 May 2020 07:46:25 -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=MbNJli3r; 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 S1729873AbgEUOn5 (ORCPT + 99 others); Thu, 21 May 2020 10:43:57 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:42918 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728229AbgEUOn4 (ORCPT ); Thu, 21 May 2020 10:43:56 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (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 B87DF40933; Thu, 21 May 2020 14:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1590072236; bh=rgL44EnEgrpVVzhE3b5dAwCouZZTfZFny+fv4sxR10g=; h=From:To:Cc:Subject:Date:From; b=MbNJli3rsFLOYILTocxmw4hGxLMGpRQ/dx3kRpIi6AUiLGkOYxMrGRFVubygMVnNs 2KAdczyTpCjeni42oDinNO8FvMeD/Zt+cWMRnrN4oy2zOS4E+ZVfaB6y7W4AjvpoYy uAnbXV4zQviuTIINuXBBEeKCmdQmIV2nn03gG115YXQjXEctreEbGbp5Rdsrh+dC59 +bPGQYtdTFF+I1iuJv7p95NTHExCLuduYi4c4ZZNQhQ6gpz056DQlTNr7XZQxGz3oC mAOycLf+70XNk7YlnT1vUAfC+xstdfiPBm8rYEI7T+m4DlAo2WX9Ah17v/zZWPDcFQ RFLNSgfoznnmw== Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id CB578A005B; Thu, 21 May 2020 14:43:46 +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 v3] Kernel selftests: Add check if TPM devices are supported Date: Thu, 21 May 2020 17:43:44 +0300 Message-Id: <20200521144344.1886-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 skipped test. Signed-off-by: Nikita Sobolev --- Changes for v2: - Coding Style cleanup Changes for v3: - Commit text message cleanup tools/testing/selftests/tpm2/test_smoke.sh | 5 +++++ tools/testing/selftests/tpm2/test_space.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh index 8155c2ea7ccb..663062701d5a 100755 --- a/tools/testing/selftests/tpm2/test_smoke.sh +++ b/tools/testing/selftests/tpm2/test_smoke.sh @@ -1,6 +1,11 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +[ -f /dev/tpm0 ] || exit $ksft_skip + python -m unittest -v tpm2_tests.SmokeTest python -m unittest -v tpm2_tests.AsyncTest diff --git a/tools/testing/selftests/tpm2/test_space.sh b/tools/testing/selftests/tpm2/test_space.sh index a6f5e346635e..36c9d030a1c6 100755 --- a/tools/testing/selftests/tpm2/test_space.sh +++ b/tools/testing/selftests/tpm2/test_space.sh @@ -1,4 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +[ -f /dev/tpmrm0 ] || exit $ksft_skip + python -m unittest -v tpm2_tests.SpaceTest -- 2.16.2