linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Tadeusz Struk <tstruk@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>,
	linux-integrity@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] selftests: tpm: add async space test with noneexisting handle
Date: Wed, 05 Jan 2022 22:07:32 +0200	[thread overview]
Message-ID: <02122eeb569342b1083e8058afe04733a99617e2.camel@kernel.org> (raw)
In-Reply-To: <20211229050655.2030-2-tstruk@gmail.com>

On Tue, 2021-12-28 at 21:06 -0800, Tadeusz Struk wrote:
> Add a test for tpm2 spaces in async mode that checks if
                 ~~~~
I would rather speak about adding a test case for /dev/tpmrm0.

> the code handles invalid handles correctly.
> 
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: <linux-integrity@vger.kernel.org>
> Cc: <linux-kselftest@vger.kernel.org>
> Cc: <linux-kernel@vger.kernel.org>
> Signed-off-by: Tadeusz Struk <tstruk@gmail.com>
> ---
>  tools/testing/selftests/tpm2/tpm2_tests.py | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tools/testing/selftests/tpm2/tpm2_tests.py
> b/tools/testing/selftests/tpm2/tpm2_tests.py
> index 9d764306887b..b373b0936e40 100644
> --- a/tools/testing/selftests/tpm2/tpm2_tests.py
> +++ b/tools/testing/selftests/tpm2/tpm2_tests.py
> @@ -302,3 +302,19 @@ class AsyncTest(unittest.TestCase):
>          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()
> +
> +    def test_flush_invlid_context(self):
> +        log = logging.getLogger(__name__)
> +        log.debug(sys._getframe().f_code.co_name)
> +
> +        async_client = tpm2.Client(tpm2.Client.FLAG_SPACE |
> tpm2.Client.FLAG_NONBLOCK)
> +        log.debug("Calling flush_context passing in an invalid
> handle ")
> +        handle = 0x80123456
> +        rc = 0
> +        try:
> +            async_client.flush_context(handle)
> +        except OSError as e:
> +            rc = e.errno
> +
> +        self.assertEqual(rc, 22)
> +        async_client.close()

BR,
Jarkko

  reply	other threads:[~2022-01-05 20:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29  5:06 [PATCH v2 1/2] tpm: Fix error handling in async work Tadeusz Struk
2021-12-29  5:06 ` [PATCH 2/2] selftests: tpm: add async space test with noneexisting handle Tadeusz Struk
2022-01-05 20:07   ` Jarkko Sakkinen [this message]
2022-01-05 20:05 ` [PATCH v2 1/2] tpm: Fix error handling in async work Jarkko Sakkinen
2022-01-07  2:51   ` Tadeusz Struk
  -- strict thread matches above, loose matches on Subject: below --
2021-12-20 21:16 [PATCH " Tadeusz Struk
2021-12-20 21:17 ` [PATCH 2/2] selftests: tpm: add async space test with noneexisting handle Tadeusz Struk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02122eeb569342b1083e8058afe04733a99617e2.camel@kernel.org \
    --to=jarkko@kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tstruk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).