linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-integrity@vger.kernel.org,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Tadeusz Struk <tadeusz.struk@intel.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] selftests/tpm2: Change exception handling to be Python 3 compatible
Date: Sun, 12 Apr 2020 17:36:54 +0300	[thread overview]
Message-ID: <20200412143656.72955-1-jarkko.sakkinen@linux.intel.com> (raw)

I need more time to fix all the byte array / string related stuff but
it makes sense to fix the exceptions as it is fairly mechanical
procedure:

1,$s/except \(.*\), \(.*\):/except \1(\2):/g

I.e. fix the low hanging fruit first and the rest later.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 tools/testing/selftests/tpm2/tpm2_tests.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/tpm2/tpm2_tests.py b/tools/testing/selftests/tpm2/tpm2_tests.py
index 728be7c69b76..c3c06899e042 100644
--- a/tools/testing/selftests/tpm2/tpm2_tests.py
+++ b/tools/testing/selftests/tpm2/tpm2_tests.py
@@ -65,7 +65,7 @@ class SmokeTest(unittest.TestCase):
         blob = self.client.seal(self.root_key, data, auth, None)
         try:
             result = self.client.unseal(self.root_key, blob, auth[:-1] + 'B', None)
-        except ProtocolError, e:
+        except ProtocolError(e):
             rc = e.rc
 
         self.assertEqual(rc, tpm2.TPM2_RC_AUTH_FAIL)
@@ -119,7 +119,7 @@ class SmokeTest(unittest.TestCase):
             self.client.policy_password(handle)
 
             result = self.client.unseal(self.root_key, blob, auth, handle)
-        except ProtocolError, e:
+        except ProtocolError(e):
             rc = e.rc
             self.client.flush_context(handle)
         except:
@@ -136,7 +136,7 @@ class SmokeTest(unittest.TestCase):
         rc = 0
         try:
             blob = self.client.seal(self.root_key, data, auth, None)
-        except ProtocolError, e:
+        except ProtocolError(e):
             rc = e.rc
 
         self.assertEqual(rc, tpm2.TPM2_RC_SIZE)
@@ -152,7 +152,7 @@ class SmokeTest(unittest.TestCase):
                               0xDEADBEEF)
 
             self.client.send_cmd(cmd)
-        except IOError, e:
+        except IOError(e):
             rejected = True
         except:
             pass
@@ -212,7 +212,7 @@ class SmokeTest(unittest.TestCase):
             self.client.tpm.write(cmd)
             rsp = self.client.tpm.read()
 
-        except IOError, e:
+        except IOError(e):
             # read the response
             rsp = self.client.tpm.read()
             rejected = True
@@ -283,7 +283,7 @@ class SpaceTest(unittest.TestCase):
         rc = 0
         try:
             space1.send_cmd(cmd)
-        except ProtocolError, e:
+        except ProtocolError(e):
             rc = e.rc
 
         self.assertEqual(rc, tpm2.TPM2_RC_COMMAND_CODE |
-- 
2.25.1


             reply	other threads:[~2020-04-12 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12 14:36 Jarkko Sakkinen [this message]
2020-04-12 15:02 ` [PATCH] selftests/tpm2: Change exception handling to be Python 3 compatible Ezra Buehler
2020-04-12 17:07   ` Jarkko Sakkinen
2020-04-13  5:02     ` Ezra Buehler
2020-04-13 18:04       ` Jarkko Sakkinen
2020-04-14  5:45         ` Ezra Buehler
2020-04-14  7:38           ` Jarkko Sakkinen
2020-04-14 11:14             ` Ezra Buehler
2020-04-14 16:05               ` Jarkko Sakkinen

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=20200412143656.72955-1-jarkko.sakkinen@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tadeusz.struk@intel.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).