Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3453039ybk; Tue, 19 May 2020 05:10:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqni+gpk07GEOomnEMAbPuGTjnn6/PV2VwqN0CXTdBuNLkOEg6da84FgZlOp1roFVF41zu X-Received: by 2002:a17:906:ae18:: with SMTP id le24mr19293199ejb.155.1589890233466; Tue, 19 May 2020 05:10:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589890233; cv=none; d=google.com; s=arc-20160816; b=g2M7x6kOwShDqwU95ylpUar0vgYJMsnd1zwOPBwo8GRFdjjDuWMVSE2u6iwa1dMuRk xnFoPZU+6OdvcCXkRrz5VjbOnPiS0oIBxbyrRJKohVzRbyLM2pAG5UyDQ6WkgTzLlAAJ bxH6+BTIMyUYDIWqgqXhGOKsVU8NPW1gT/JAobkp8fPZzY6h9QBRAN6yaXYi2OmeMMXd Gd/597tQJeEra6StDwvTJiPoPyHJbWRLcgimbkVLH4avDbMO1OilV44O/KTvftkOWFgN aIrbyb4tk5k+F2hSSBh24YxG1BzC4+lMeg+PMQBz1e9D1VzUPtYCRgyXkC1N8Sjr4j0B wUeA== 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=brl5+FzD5PP+VxDCHPSf8iomrXf34maW1UX+iKfSEgw=; b=Tvtf5fh9X63Jp3I3Od1WpqiKuIS+B3dtbyE+5OcGr91nDOJqFZuwtpckdD0e7etGRc +f2Ich5+KD7QtpVW6isE4NU/mOEQ7kp18SGTmgQwRPQResWzodzFInMk3wtZvPY83Enu Jsv+GOdMKYIWif8jYiFhoGgouQ2Lg2qOzvSY5EGssK7XnmUPpEPGdU/gLfo1wNaGQhw3 qtCeUJ1OvDXpISCpLorIanRoaELnOD3wjjZS0QmQ6JqNtNKdX/0XLrg1uQ3EW1swhENt mdk0+XDSo4CNiy4HH3PKMRoI07b5MhCOJcSTgTKIrjVv7eaDLoFR3nXIGOrLVyNeYx/l blMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=F98P3paC; 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 p9si803698ejo.380.2020.05.19.05.10.07; Tue, 19 May 2020 05:10:33 -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=F98P3paC; 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 S1728872AbgESMIZ (ORCPT + 99 others); Tue, 19 May 2020 08:08:25 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:54250 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgESMIY (ORCPT ); Tue, 19 May 2020 08:08:24 -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 923684050C; Tue, 19 May 2020 12:08:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1589890104; bh=5U+7CPG84Fx9MSC1QbUrTwvZo58qbTd3QcFm6yKsI9w=; h=From:To:Cc:Subject:Date:From; b=F98P3paCBmltrL9S1Ef3yazrOSEjbRdI26DYsfv2I2yxHmGNMcUsqop8Y7FREVDc3 Wg/vfiP+OdUO7px0l6hJYguCZuz7vHcWf7j8UzRXi3kBpefueDrNVeOnc3tTIsagbh BgZxwOcFZp5+Ydrk7B/h7yPkZzHf4zRWCm44ILp+MLX1u8oJ+rsIzXiVdj7Jm6jOzH M0atw6L9jbRYj1i1S/lBuKHrASrNSuNKhe8y3G1RAs5Nwc2fqQwg+Sv+Aw18Rf7DmI IUqX7hymMrvVkOXUIZLcGKMRHhpHvdgqiTRADRjVlCv4U6MePR5lfEzTUi5q7soC+6 Cfzrei8hUv9bQ== Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 716F7A005C; Tue, 19 May 2020 12:08:20 +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 v2] Kernel selftests: Add check if tpm devices are supported Date: Tue, 19 May 2020 15:07:43 +0300 Message-Id: <20200519120743.41358-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 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