Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109505603
D36861.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D36861.diff
View Options
diff --git a/tests/sys/opencrypto/cryptodev.py b/tests/sys/opencrypto/cryptodev.py
--- a/tests/sys/opencrypto/cryptodev.py
+++ b/tests/sys/opencrypto/cryptodev.py
@@ -38,6 +38,7 @@
import os
import platform
import random
+import re
import signal
from struct import pack as _pack
import sys
@@ -258,7 +259,7 @@
caead.op = op
caead.flags = CRD_F_IV_EXPLICIT
caead.flags = 0
- if src is not None and len(src) != 0:
+ if src:
src = str_to_ascii(src)
caead.len = len(src)
s = array.array('B', src)
@@ -287,7 +288,7 @@
ioctl(_cryptodev, CIOCCRYPTAEAD, bytes(caead))
- if src is not None:
+ if src:
s = array_tobytes(s)
else:
s = empty_bytes()
@@ -358,6 +359,7 @@
self._pending = None
self.fname = fname
self.fp = None
+ self.field_re = re.compile(r"\[(?P<field>[^]]+)\]")
def __enter__(self):
self.fp = open(self.fname)
@@ -372,24 +374,22 @@
def __next__(self):
while True:
- didread = False
- if self._pending is not None:
- i = self._pending
- self._pending = None
- else:
- i = self.fp.readline()
- didread = True
-
- if didread and not i:
- return
-
- if not i.startswith('#') and i.strip():
- break
+ while True:
+ if self._pending is not None:
+ i = self._pending
+ self._pending = None
+ else:
+ i = self.fp.readline()
+ if not i:
+ return
+
+ if not i.startswith('#') and i.strip():
+ break
- if i[0] == '[':
- yield i[1:].split(']', 1)[0], self.fielditer()
- else:
- raise ValueError('unknown line: %r' % repr(i))
+ matches = self.field_re.match(i)
+ if matches is None:
+ raise ValueError("Unknown line: %r" % (i))
+ yield matches.group("field"), self.fielditer()
def eatblanks(self):
while True:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 11:15 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16502808
Default Alt Text
D36861.diff (2 KB)
Attached To
Mode
D36861: test/sys/opencrypto: Fix NIST KAT parser iterator
Attached
Detach File
Event Timeline
Log In to Comment