Linux-kselftest Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/3] selftests: tpm: fixes
@ 2020-06-22 21:20 Jarkko Sakkinen
  2020-06-22 21:20 ` [PATCH 1/3] Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test" Jarkko Sakkinen
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-22 21:20 UTC (permalink / raw)
  To: Shuah Khan
  Cc: pengfei.xu, Jarkko Sakkinen, Joey Pabalinas, open list,
	open list:KERNEL SELFTEST FRAMEWORK, Nikita Sobolev, Petr Vorel,
	Shuah Khan, Tadeusz Struk

A few fixes for tools/testing/selftests/tpm.

Jarkko Sakkinen (3):
  Revert "tpm: selftest: cleanup after unseal with wrong auth/policy
    test"
  selftests: tpm: Use 'test -e' instead of 'test -f'
  selftests: tpm: Use /bin/sh instead of /bin/bash

 tools/testing/selftests/tpm2/test_smoke.sh | 9 ++-------
 tools/testing/selftests/tpm2/test_space.sh | 4 ++--
 2 files changed, 4 insertions(+), 9 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test"
  2020-06-22 21:20 [PATCH 0/3] selftests: tpm: fixes Jarkko Sakkinen
@ 2020-06-22 21:20 ` Jarkko Sakkinen
  2020-06-22 21:20 ` [PATCH 2/3] selftests: tpm: Use 'test -e' instead of 'test -f' Jarkko Sakkinen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-22 21:20 UTC (permalink / raw)
  To: Shuah Khan
  Cc: pengfei.xu, Jarkko Sakkinen, Tadeusz Struk, stable,
	linux-integrity, linux-kselftest, Nikita Sobolev, Petr Vorel,
	open list

The reverted commit illegitly uses tpm2-tools. External dependencies are
absolutely forbidden from these tests. There is also the problem that
clearing is not necessarily wanted behavior if the test/target computer is
not used only solely for testing.

Fixes: a9920d3bad40 ("tpm: selftest: cleanup after unseal with wrong auth/policy test")
Cc: Tadeusz Struk <tadeusz.struk@intel.com>
Cc: stable@vger.kernel.org
Cc: linux-integrity@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 tools/testing/selftests/tpm2/test_smoke.sh | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh
index 663062701d5a..79f8e9da5d21 100755
--- a/tools/testing/selftests/tpm2/test_smoke.sh
+++ b/tools/testing/selftests/tpm2/test_smoke.sh
@@ -8,8 +8,3 @@ ksft_skip=4
 
 python -m unittest -v tpm2_tests.SmokeTest
 python -m unittest -v tpm2_tests.AsyncTest
-
-CLEAR_CMD=$(which tpm2_clear)
-if [ -n $CLEAR_CMD ]; then
-	tpm2_clear -T device
-fi
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] selftests: tpm: Use 'test -e' instead of 'test -f'
  2020-06-22 21:20 [PATCH 0/3] selftests: tpm: fixes Jarkko Sakkinen
  2020-06-22 21:20 ` [PATCH 1/3] Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test" Jarkko Sakkinen
@ 2020-06-22 21:20 ` Jarkko Sakkinen
  2020-06-22 21:20 ` [PATCH 3/3] selftests: tpm: Use /bin/sh instead of /bin/bash Jarkko Sakkinen
  2020-06-29 20:21 ` [PATCH 0/3] selftests: tpm: fixes Shuah Khan
  3 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-22 21:20 UTC (permalink / raw)
  To: Shuah Khan
  Cc: pengfei.xu, Jarkko Sakkinen, Nikita Sobolev, linux-integrity,
	linux-kselftest, Tadeusz Struk, Petr Vorel, open list

'test -f' is suitable only for *regular* files. Use 'test -e' instead.

Cc: Nikita Sobolev <Nikita.Sobolev@synopsys.com>
Cc: linux-integrity@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Fixes: 5627f9cffee7 ("Kernel selftests: Add check if TPM devices are supported")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 tools/testing/selftests/tpm2/test_smoke.sh | 2 +-
 tools/testing/selftests/tpm2/test_space.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh
index 79f8e9da5d21..338d6b0272dc 100755
--- a/tools/testing/selftests/tpm2/test_smoke.sh
+++ b/tools/testing/selftests/tpm2/test_smoke.sh
@@ -4,7 +4,7 @@
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
-[ -f /dev/tpm0 ] || exit $ksft_skip
+[ -e /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 36c9d030a1c6..847cabb20a5f 100755
--- a/tools/testing/selftests/tpm2/test_space.sh
+++ b/tools/testing/selftests/tpm2/test_space.sh
@@ -4,6 +4,6 @@
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
-[ -f /dev/tpmrm0 ] || exit $ksft_skip
+[ -e /dev/tpmrm0 ] || exit $ksft_skip
 
 python -m unittest -v tpm2_tests.SpaceTest
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] selftests: tpm: Use /bin/sh instead of /bin/bash
  2020-06-22 21:20 [PATCH 0/3] selftests: tpm: fixes Jarkko Sakkinen
  2020-06-22 21:20 ` [PATCH 1/3] Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test" Jarkko Sakkinen
  2020-06-22 21:20 ` [PATCH 2/3] selftests: tpm: Use 'test -e' instead of 'test -f' Jarkko Sakkinen
@ 2020-06-22 21:20 ` Jarkko Sakkinen
  2020-06-29 20:21 ` [PATCH 0/3] selftests: tpm: fixes Shuah Khan
  3 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-22 21:20 UTC (permalink / raw)
  To: Shuah Khan
  Cc: pengfei.xu, Jarkko Sakkinen, stable, linux-integrity,
	linux-kselftest, Tadeusz Struk, Nikita Sobolev, Petr Vorel,
	Joey Pabalinas, open list

It's better to use /bin/sh instead of /bin/bash in order to run the tests
in the BusyBox shell.

Fixes: 6ea3dfe1e073 ("selftests: add TPM 2.0 tests")
Cc: stable@vger.kernel.org
Cc: linux-integrity@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 tools/testing/selftests/tpm2/test_smoke.sh | 2 +-
 tools/testing/selftests/tpm2/test_space.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh
index 338d6b0272dc..1334e301d2a0 100755
--- a/tools/testing/selftests/tpm2/test_smoke.sh
+++ b/tools/testing/selftests/tpm2/test_smoke.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
 
 # Kselftest framework requirement - SKIP code is 4.
diff --git a/tools/testing/selftests/tpm2/test_space.sh b/tools/testing/selftests/tpm2/test_space.sh
index 847cabb20a5f..00259cb746cf 100755
--- a/tools/testing/selftests/tpm2/test_space.sh
+++ b/tools/testing/selftests/tpm2/test_space.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
 
 # Kselftest framework requirement - SKIP code is 4.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] selftests: tpm: fixes
  2020-06-22 21:20 [PATCH 0/3] selftests: tpm: fixes Jarkko Sakkinen
                   ` (2 preceding siblings ...)
  2020-06-22 21:20 ` [PATCH 3/3] selftests: tpm: Use /bin/sh instead of /bin/bash Jarkko Sakkinen
@ 2020-06-29 20:21 ` Shuah Khan
  2020-07-02 23:07   ` Jarkko Sakkinen
  3 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2020-06-29 20:21 UTC (permalink / raw)
  To: Jarkko Sakkinen, Shuah Khan
  Cc: pengfei.xu, Joey Pabalinas, open list,
	open list:KERNEL SELFTEST FRAMEWORK, Nikita Sobolev, Petr Vorel,
	Tadeusz Struk, Shuah Khan

On 6/22/20 3:20 PM, Jarkko Sakkinen wrote:
> A few fixes for tools/testing/selftests/tpm.
> 
> Jarkko Sakkinen (3):
>    Revert "tpm: selftest: cleanup after unseal with wrong auth/policy
>      test"
>    selftests: tpm: Use 'test -e' instead of 'test -f'
>    selftests: tpm: Use /bin/sh instead of /bin/bash
> 
>   tools/testing/selftests/tpm2/test_smoke.sh | 9 ++-------
>   tools/testing/selftests/tpm2/test_space.sh | 4 ++--
>   2 files changed, 4 insertions(+), 9 deletions(-)
> 

Applied to linux-kselftest fixes for Linux 5.8-rc4

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] selftests: tpm: fixes
  2020-06-29 20:21 ` [PATCH 0/3] selftests: tpm: fixes Shuah Khan
@ 2020-07-02 23:07   ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-07-02 23:07 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Shuah Khan, pengfei.xu, Joey Pabalinas, open list,
	open list:KERNEL SELFTEST FRAMEWORK, Nikita Sobolev, Petr Vorel,
	Tadeusz Struk

On Mon, Jun 29, 2020 at 02:21:47PM -0600, Shuah Khan wrote:
> On 6/22/20 3:20 PM, Jarkko Sakkinen wrote:
> > A few fixes for tools/testing/selftests/tpm.
> > 
> > Jarkko Sakkinen (3):
> >    Revert "tpm: selftest: cleanup after unseal with wrong auth/policy
> >      test"
> >    selftests: tpm: Use 'test -e' instead of 'test -f'
> >    selftests: tpm: Use /bin/sh instead of /bin/bash
> > 
> >   tools/testing/selftests/tpm2/test_smoke.sh | 9 ++-------
> >   tools/testing/selftests/tpm2/test_space.sh | 4 ++--
> >   2 files changed, 4 insertions(+), 9 deletions(-)
> > 
> 
> Applied to linux-kselftest fixes for Linux 5.8-rc4

Thank you.

/Jarkko

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 21:20 [PATCH 0/3] selftests: tpm: fixes Jarkko Sakkinen
2020-06-22 21:20 ` [PATCH 1/3] Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test" Jarkko Sakkinen
2020-06-22 21:20 ` [PATCH 2/3] selftests: tpm: Use 'test -e' instead of 'test -f' Jarkko Sakkinen
2020-06-22 21:20 ` [PATCH 3/3] selftests: tpm: Use /bin/sh instead of /bin/bash Jarkko Sakkinen
2020-06-29 20:21 ` [PATCH 0/3] selftests: tpm: fixes Shuah Khan
2020-07-02 23:07   ` Jarkko Sakkinen

Linux-kselftest Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-kselftest/0 linux-kselftest/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-kselftest linux-kselftest/ https://lore.kernel.org/linux-kselftest \
		linux-kselftest@vger.kernel.org
	public-inbox-index linux-kselftest

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kselftest


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git