[Cryptech-Commits] [sw/libhal] branch ksng updated: More attribute bloat tests, pinwheel to monitor progress.
git at cryptech.is
git at cryptech.is
Fri Nov 4 05:48:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch ksng
in repository sw/libhal.
The following commit(s) were added to refs/heads/ksng by this push:
new 203b8af More attribute bloat tests, pinwheel to monitor progress.
203b8af is described below
commit 203b8af55d66d825b6268d8a97cd76fb66cda38f
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Fri Nov 4 01:41:59 2016 -0400
More attribute bloat tests, pinwheel to monitor progress.
Watching the pinwheel makes it clear that the painfully slow execution
of test_attribute_bloat_flash_many() isn't a single hidously long
delay anywhere, rather it's a long steady stream of slow operations
and it's the cumulative time that's hurting us. Most likely this is
entirely dominated by flash write time, and suggests that it may be
worth the additional API and implementation complexity to handle
setting a complete set of attributes in a single operation, so that we
only have to pay the flash write toll once.
Will probably require further testing before we can make an informed
decision.
---
unit-tests.py | 45 +++++++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/unit-tests.py b/unit-tests.py
index 7074c6d..dc13265 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -512,8 +512,7 @@ class TestPKeyList(TestCaseLoggedIn):
def load_keys(self, flags):
for obj in PreloadedKey.db.itervalues():
with hsm.pkey_load(obj.keytype, obj.curve, obj.der, flags) as k:
- self.addCleanup(lambda uuid: hsm.pkey_find(uuid, flags = flags).delete(),
- k.uuid)
+ self.addCleanup(lambda uuid: hsm.pkey_find(uuid, flags = flags).delete(), k.uuid)
for i, a in enumerate((str(obj.keytype), str(obj.fn2))):
k.set_attribute(i, a)
@@ -583,21 +582,29 @@ class TestPKeyAttribute(TestCaseLoggedIn):
Attribute creation/lookup/deletion tests.
"""
- def load_and_fill(self, flags, n_keys = 1, n_attrs = 2):
+ def load_and_fill(self, flags, n_keys = 1, n_attrs = 2, n_fill = 0):
+ pinwheel = Pinwheel()
for i in xrange(n_keys):
for obj in PreloadedKey.db.itervalues():
with hsm.pkey_load(obj.keytype, obj.curve, obj.der, flags) as k:
- self.addCleanup(lambda uuid: hsm.pkey_find(uuid, flags = flags).delete(),
- k.uuid)
+ pinwheel()
+ self.addCleanup(lambda uuid: hsm.pkey_find(uuid, flags = flags).delete(), k.uuid)
for j in xrange(n_attrs):
- k.set_attribute(j, "Attribute {}".format(j))
+ k.set_attribute(j, "Attribute {}{}".format(j, "*" * n_fill))
+ pinwheel()
- def test_attribute_bloat_volatile(self):
+ def test_attribute_bloat_volatile_many(self):
self.load_and_fill(0, n_attrs = 192)
- def test_attribute_bloat_token(self):
+ def test_attribute_bloat_volatile_big(self):
+ self.load_and_fill(0, n_attrs = 6, n_fill = 512)
+
+ def test_attribute_bloat_token_many(self):
self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 128)
+ def test_attribute_bloat_token_big(self):
+ self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 16, n_fill = 1024)
+
@unittest.skipUnless(ecdsa_loaded, "Requires Python ECDSA package")
class TestPkeyECDSAVerificationNIST(TestCaseLoggedIn):
@@ -647,6 +654,28 @@ class TestPkeyECDSAVerificationNIST(TestCaseLoggedIn):
+class Pinwheel(object):
+ """
+ Activity pinwheel, as needed.
+ """
+
+ def __init__(self):
+ self.pinwheel = tuple("\b\b{} ".format(c) for c in "-/|\\")
+ self.modulo = len(self.pinwheel)
+ self.position = 0
+ if not args.quiet:
+ from sys import stdout
+ stdout.write(". ")
+ stdout.flush()
+
+ def __call__(self):
+ if not args.quiet:
+ from sys import stdout
+ stdout.write(self.pinwheel[self.position])
+ stdout.flush()
+ self.position = (self.position + 1) % self.modulo
+
+
class PreloadedKey(object):
"""
Keys for preload tests, here at the end because they're large.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Commits
mailing list