summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2024-08-28 13:23:20 +0200
committerJarkko Sakkinen <jarkko@kernel.org>2024-09-17 18:56:37 +0300
commit27141f1950b8e40499a7aa95341cd5a37029a097 (patch)
tree56ac450af789a1f38956e3b60f26686d0aee26a7 /tools
parent5e515e13eba3b335aa97e2a2e57b86118522cf28 (diff)
selftests: tpm2: test_smoke: Run only when TPM2 is avaialable.
Since Linux 5.6 tpm_version_major sysfs file is avaialble which gives the TPM version. Using this file the test can be skipped on systems with TPM 1.2. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/tpm2/test_smoke.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh
index 20fa70f970a9..168f4b166234 100755
--- a/tools/testing/selftests/tpm2/test_smoke.sh
+++ b/tools/testing/selftests/tpm2/test_smoke.sh
@@ -5,5 +5,7 @@
ksft_skip=4
[ -e /dev/tpm0 ] || exit $ksft_skip
+read tpm_version < /sys/class/tpm/tpm0/tpm_version_major
+[ "$tpm_version" == 2 ] || exit $ksft_skip
python3 -m unittest -v tpm2_tests.SmokeTest 2>&1