https://github.com/mupq/pqm4
Revision ae06d3dfc39e62f24a6dbb62d8e15a198b536d29 authored by Matthias J. Kannwischer on 31 January 2019, 10:15:17 UTC, committed by Joost Rijneveld on 31 January 2019, 10:15:17 UTC
* add kyber512 and kyber1024 ref

* add m4 optimized kyber512 and kyber1024

* add kyber512 and kyber1024 benchmarks
1 parent c589096
Raw File
Tip revision: ae06d3dfc39e62f24a6dbb62d8e15a198b536d29 authored by Matthias J. Kannwischer on 31 January 2019, 10:15:17 UTC
Add kyber512 and kyber1024 (#35)
Tip revision: ae06d3d
test.py
#!/usr/bin/env python3
import serial
import sys
import os
import subprocess
import utils


try:
    binaries = [x for x in os.listdir('bin') if 'test.bin' in x]
except FileNotFoundError:
    print("There is no bin/ folder. Please first make binaries.")
    sys.exit(1)

def doTest(binary):
    binpath = os.path.join("bin", binary)
    info = binary.split('_')
    primitive = '_'.join(info[:2])
    scheme = '_'.join(info[2:-2])
    implementation = info[-2]

    if utils.m4ignore(primitive, scheme, implementation):
        return

    if len(sys.argv) > 1 and scheme not in sys.argv[1:]:
       return

    result = utils.m4run(binpath)


    print("Testing if tests were successful..")
    contents = result.strip()
    # can we find a nicer way of checking if tests ran correctly?
    if contents.count("ERROR") != 0 or contents.count("OK") != 30:
        print("FAILED!")
    else:
        print("passed.")

for binary in binaries:
    doTest(binary)
back to top