diff options
author | Tadeusz Struk <tadeusz.struk@intel.com> | 2019-12-12 09:48:53 -0800 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2019-12-17 12:20:12 +0200 |
commit | 8f84bddcfac9117564721ead494db7a604fdf861 (patch) | |
tree | 3bdab5b6f54ebdc85b127de9976511e07afe1318 /tools/testing/selftests/tpm2/tpm2_tests.py | |
parent | tpm: fix invalid locking in NONBLOCKING mode (diff) | |
download | linux-dev-8f84bddcfac9117564721ead494db7a604fdf861.tar.xz linux-dev-8f84bddcfac9117564721ead494db7a604fdf861.zip |
tpm: selftest: add test covering async mode
Add a test that sends a tpm cmd in an async mode.
Currently there is a gap in test coverage with regards
to this functionality.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'tools/testing/selftests/tpm2/tpm2_tests.py')
-rw-r--r-- | tools/testing/selftests/tpm2/tpm2_tests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/tpm2/tpm2_tests.py b/tools/testing/selftests/tpm2/tpm2_tests.py index d4973be53493..728be7c69b76 100644 --- a/tools/testing/selftests/tpm2/tpm2_tests.py +++ b/tools/testing/selftests/tpm2/tpm2_tests.py @@ -288,3 +288,16 @@ class SpaceTest(unittest.TestCase): self.assertEqual(rc, tpm2.TPM2_RC_COMMAND_CODE | tpm2.TSS2_RESMGR_TPM_RC_LAYER) + +class AsyncTest(unittest.TestCase): + def setUp(self): + logging.basicConfig(filename='AsyncTest.log', level=logging.DEBUG) + + def test_async(self): + log = logging.getLogger(__name__) + log.debug(sys._getframe().f_code.co_name) + + async_client = tpm2.Client(tpm2.Client.FLAG_NONBLOCK) + log.debug("Calling get_cap in a NON_BLOCKING mode") + async_client.get_cap(tpm2.TPM2_CAP_HANDLES, tpm2.HR_LOADED_SESSION) + async_client.close() |