aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/tpm2/test_smoke.sh
diff options
context:
space:
mode:
authorNikita Sobolev <Nikita.Sobolev@synopsys.com>2020-01-31 18:25:23 +0300
committerShuah Khan <skhan@linuxfoundation.org>2020-02-10 18:00:40 -0700
commitb32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc (patch)
treeb8b054c1a0f392efd15ccfb743fa393ecaf005d8 /tools/testing/selftests/tpm2/test_smoke.sh
parentselftests/ftrace: Have pid filter test use instance flag (diff)
downloadlinux-dev-b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc.tar.xz
linux-dev-b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc.zip
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>
Diffstat (limited to 'tools/testing/selftests/tpm2/test_smoke.sh')
-rwxr-xr-xtools/testing/selftests/tpm2/test_smoke.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh
index 8155c2ea7ccb..b630c7b5950a 100755
--- a/tools/testing/selftests/tpm2/test_smoke.sh
+++ b/tools/testing/selftests/tpm2/test_smoke.sh
@@ -1,8 +1,17 @@
#!/bin/bash
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
+self.flags = flags
-python -m unittest -v tpm2_tests.SmokeTest
-python -m unittest -v tpm2_tests.AsyncTest
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+
+if [ -f /dev/tpm0 ] ; then
+ python -m unittest -v tpm2_tests.SmokeTest
+ python -m unittest -v tpm2_tests.AsyncTest
+else
+ exit $ksft_skip
+fi
CLEAR_CMD=$(which tpm2_clear)
if [ -n $CLEAR_CMD ]; then