Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Kernel selftests: tpm2: check for tpm support

tpm2 tests set fails if there is no /dev/tpm0 and /dev/tpmrm0
supported. Check if these files exist before run and mark test as
skipped in case of absence.

Signed-off-by: Nikita Sobolev <Nikita.Sobolev@synopsys.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Nikita Sobolev and committed by
Shuah Khan
b32694cd a098d9c8

+19 -3
+11 -2
tools/testing/selftests/tpm2/test_smoke.sh
··· 1 1 #!/bin/bash 2 2 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) 3 + self.flags = flags 3 4 4 - python -m unittest -v tpm2_tests.SmokeTest 5 - python -m unittest -v tpm2_tests.AsyncTest 5 + # Kselftest framework requirement - SKIP code is 4. 6 + ksft_skip=4 7 + 8 + 9 + if [ -f /dev/tpm0 ] ; then 10 + python -m unittest -v tpm2_tests.SmokeTest 11 + python -m unittest -v tpm2_tests.AsyncTest 12 + else 13 + exit $ksft_skip 14 + fi 6 15 7 16 CLEAR_CMD=$(which tpm2_clear) 8 17 if [ -n $CLEAR_CMD ]; then
+8 -1
tools/testing/selftests/tpm2/test_space.sh
··· 1 1 #!/bin/bash 2 2 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) 3 3 4 - python -m unittest -v tpm2_tests.SpaceTest 4 + # Kselftest framework requirement - SKIP code is 4. 5 + ksft_skip=4 6 + 7 + if [ -f /dev/tpmrm0 ] ; then 8 + python -m unittest -v tpm2_tests.SpaceTest 9 + else 10 + exit $ksft_skip 11 + fi