aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/test_cli.py
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-06-19 12:26:59 -0400
committerJack Lloyd <[email protected]>2018-06-19 12:26:59 -0400
commit661173d1f8a70133ae2e5bfacefa9d4892aadd94 (patch)
tree1af11a5676db6020ed7f1330988bdc9981dc1fe0 /src/scripts/test_cli.py
parent2de5e91c986699038f2c743d894e1a699452689c (diff)
More cli tests
Diffstat (limited to 'src/scripts/test_cli.py')
-rwxr-xr-xsrc/scripts/test_cli.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/scripts/test_cli.py b/src/scripts/test_cli.py
index 82eb2e0d1..c9348f620 100755
--- a/src/scripts/test_cli.py
+++ b/src/scripts/test_cli.py
@@ -289,6 +289,7 @@ MCACAQUTBnN0cmluZzEGAQH/AgFjBAUAAAAAAAMEAP///w==
test_cli("asn1print", "--pem -", expected, input_pem)
def cli_speed_tests():
+ # pylint: disable=too-many-branches
output = test_cli("speed", ["--msec=1", "--buf-size=64,512", "AES-128"], None).split('\n')
if len(output) % 4 != 0:
@@ -321,6 +322,32 @@ def cli_speed_tests():
if format_re.match(line) is None:
logging.error("Unexpected line %s", line)
+ math_ops = ['mp_mul', 'random_prime', 'inverse_mod',
+ 'bn_redc', 'nistp_redc', 'ecc_mult', 'ecc_ops', 'os2ecp']
+
+ format_re = re.compile(r'^.* [0-9]+ /sec; [0-9]+\.[0-9]+ ms/op .*\([0-9]+ (op|ops) in [0-9]+(\.[0-9]+)? ms\)')
+ for op in math_ops:
+ output = test_cli("speed", ["--msec=15", op], None).split('\n')
+ for line in output:
+ if format_re.match(line) is None:
+ logging.error("Unexpected line %s", line)
+
+ output = test_cli("speed", ["--msec=5", "scrypt"], None).split('\n')
+
+ format_re = re.compile(r'^scrypt-[0-9]+-[0-9]+-[0-9]+ [0-9]+ /sec; [0-9]+\.[0-9]+ ms/op .*\([0-9]+ (op|ops) in [0-9]+ ms\)')
+
+ for line in output:
+ if format_re.match(line) is None:
+ logging.error("Unexpected line %s", line)
+
+ output = test_cli("speed", ["--msec=5", "RNG"], None).split('\n')
+
+ # ChaCha_RNG generate buffer size 1024 bytes: 954.431 MiB/sec 4.01 cycles/byte (477.22 MiB in 500.00 ms)
+ format_re = re.compile(r'^.* generate buffer size [0-9]+ bytes: [0-9]+\.[0-9]+ MiB/sec .*\([0-9]+\.[0-9]+ MiB in [0-9]+\.[0-9]+ ms')
+ for line in output:
+ if format_re.match(line) is None:
+ logging.error("Unexpected line %s", line)
+
def main(args=None):
if args is None:
args = sys.argv