Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3526421ybk; Tue, 19 May 2020 06:52:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAO4cd65GWt/JYfbbY/PV5Fiz1/BDPkmn6TsAQYw89gQMFZ2XRZ87gTD8SwN1BvXdMNEGM X-Received: by 2002:a17:906:651:: with SMTP id t17mr743247ejb.394.1589896357262; Tue, 19 May 2020 06:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589896357; cv=none; d=google.com; s=arc-20160816; b=A0BPSpom54nKEWH9Dw6DhRnfw4BfNbs3XEawynUK07yhyXB/ZIV5MwhjrdFCSCOLt0 sgW4jM7xVVkHCmm9047w3gqLOb0ddapPZwplz1+aY9HLntqAexWJmRtSdTUlRZgGORGe UuSnHwlbfEdIACuauPXLyMMpLXHNThXVR3yIPIdiTwUJSYSZHzR7Sj81FOITNiPMxq82 7OXNZZ7cPnh0puJhG9xkJv2UnjY9RNciCw9jtJLrkIUIEcla/o3WyquD+7S+PCLLhFMr E2bLEjPLdNfLfmyeT4knZr/1uf2r1ZjMayGiRBk7vk9kIqdMJXWGxB9Rjbpu4CNwxEZn 2E6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=AHHk9jLpnOwwlGMrtT5OgNDA6Lcah1FmYDFSCF+BH7I=; b=u5/XgYQpYghavFd9AtNVLk22MeteG3JPtKbBW9f9WpWbjQmQmMAcg2KqWC4jwgq3rA tRxpWQp6VZoB7pHXdp7PUDnkL/LJ6pnUt+HmERbjQBZxrSiHF3Y8Tf80IXHlqJAWwtWI ZW+xnnvVCt2lwEUZ6OfwGmzFTaq52M1QaoKLNcR2hX4s3tJy/QkKS6A4+xzW90H7ntas 7h63Q2fl4LVOvZhmuruaasgLPsROxg5V3+IvmhKDrWZlJ+AoBcuRvtMMaC8id2EJstg1 W0zX315oO0g/iKIdLiNZxRTEElMC5sbgc37Sp3wzKWRRCNf6k9OyrlJ0uIOKlfLNzGTP C09Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si8805349ejx.150.2020.05.19.06.52.12; Tue, 19 May 2020 06:52:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728847AbgESNsp (ORCPT + 99 others); Tue, 19 May 2020 09:48:45 -0400 Received: from mga01.intel.com ([192.55.52.88]:11239 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727904AbgESNsp (ORCPT ); Tue, 19 May 2020 09:48:45 -0400 IronPort-SDR: DH9iWt0FTcQdz2aCiRimaTvtF4CiSXK9q5NYvxvYbIgtIchL1qzlCSC6KXZhQk+D+2fXRFVxPu FhfSkWvsjn3Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 06:48:44 -0700 IronPort-SDR: H/JFjAHMwzZmTTusqpdysvxKXqFJF23mHNOpHPdTHd356dHLXcuk5QvGRbP68bBgYzBfk6LPVq nS0/01vIj02w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,410,1583222400"; d="scan'208";a="343140365" Received: from joelin3-mobl.gar.corp.intel.com (HELO localhost) ([10.249.42.57]) by orsmga001.jf.intel.com with ESMTP; 19 May 2020 06:48:39 -0700 Date: Tue, 19 May 2020 16:48:38 +0300 From: Jarkko Sakkinen To: Nikita Sobolev Cc: Shuah Khan , linux-kselftest@vger.kernel.org, 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 Subject: Re: [PATCH] Kernel selftests: Add check if tpm devices are supported Message-ID: <20200519134838.GA17129@linux.intel.com> References: <20200518213934.23156-1-Nikita.Sobolev@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200518213934.23156-1-Nikita.Sobolev@synopsys.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 12:39:34AM +0300, Nikita Sobolev wrote: > 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 tpm2 tests set -> TPM2 test suite Fixes tag is also required. There is nothing cool writing acronyms in lower case, so lets just always write them correctly. > --- > 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 > This would make the change more compact: # Kselftest framework requirement - SKIP code is 4. if [ ! -f /dev/tpmrm0 ] ; then exit 4 fi python -m unittest -v tpm2_tests.SpaceTest (also for /dev/tpm0) /Jarkko