Skip to content

Commit 5627f9c

Browse files
Nikita Sobolevshuahkh
authored andcommitted
Kernel selftests: Add check if TPM devices are supported
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 <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 2e9a972 commit 5627f9c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tools/testing/selftests/tpm2/test_smoke.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
33

4+
# Kselftest framework requirement - SKIP code is 4.
5+
ksft_skip=4
6+
7+
[ -f /dev/tpm0 ] || exit $ksft_skip
8+
49
python -m unittest -v tpm2_tests.SmokeTest
510
python -m unittest -v tpm2_tests.AsyncTest
611

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
33

4+
# Kselftest framework requirement - SKIP code is 4.
5+
ksft_skip=4
6+
7+
[ -f /dev/tpmrm0 ] || exit $ksft_skip
8+
49
python -m unittest -v tpm2_tests.SpaceTest

0 commit comments

Comments
 (0)