]> www.infradead.org Git - users/willy/xarray.git/commitdiff
selftests: tpm2: test_smoke: Run only when TPM2 is avaialable.
authorMichal Suchanek <msuchanek@suse.de>
Wed, 28 Aug 2024 11:23:20 +0000 (13:23 +0200)
committerJarkko Sakkinen <jarkko@kernel.org>
Tue, 17 Sep 2024 15:56:37 +0000 (18:56 +0300)
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>
tools/testing/selftests/tpm2/test_smoke.sh

index 20fa70f970a9a72d70441b9882dbd39acc97fb7b..168f4b166234af12302fafdb9b8a86d93401ea5c 100755 (executable)
@@ -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