From: Michal Suchanek Date: Wed, 28 Aug 2024 11:23:20 +0000 (+0200) Subject: selftests: tpm2: test_smoke: Run only when TPM2 is avaialable. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=27141f1950b8e40499a7aa95341cd5a37029a097;p=users%2Fwilly%2Fxarray.git 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 Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen --- 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