Install test dependencies and build on OSX GCC

Este commit está contenido en:
Thom Wiggers 2019-01-22 15:21:49 +01:00
padre 4cac434f47
commit d66bef0284
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 001BB0A7CE26E363
Se han modificado 4 ficheros con 53 adiciones y 22 borrados

Ver fichero

@ -8,25 +8,54 @@ matrix:
compiler: gcc
env:
- MAKETARGET="test-all tidy-all check-format"
addons:
apt:
sources:
- deadsnakes
packages:
- valgrind
- python3.7
- os: linux
compiler: clang
env:
- MAKETARGET=test-all
addons:
apt:
sources:
- deadsnakes
packages:
- valgrind
- python3.7
- os: osx
osx_image: xcode10.1
compiler: clang
env:
- MAKETARGET=test-all
# This currently appears to be broken.
# - os: osx
# env:
# - MATRIX_EVAL="brew install gcc && CC=gcc-8 && CXX=g++-8"
# - MAKETARGET=test-all
addons:
homebrew:
packages:
- python@3.7
- os: osx
osx_image: xcode10.1
compiler: gcc
addons:
homebrew:
packages:
- gcc@8
- python@3.7
env:
- MAKETARGET=test-all
before_install:
- eval "${MATRIX_EVAL}"
- python3.7 --version
- curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- python3.7 get-pip.py --user
- python3.7 -mpip install -r requirements.txt
script:
- make ${MAKETARGET}
cache: pip
# vim: set ft=yaml ts=2 sw=2 tw=0 et :

Ver fichero

@ -149,22 +149,22 @@ run-valgrind-all:
.PHONY: run-testvectors
run-testvectors: test/check_testvectors.py | require_scheme
python3 test/check_testvectors.py $(SCHEME) || exit 1; \
python3.7 test/check_testvectors.py $(SCHEME) || exit 1; \
.PHONY: run-symbol-namespace
run-symbol-namespace: test/check_symbol_namespace.py | require_scheme
python3 test/check_symbol_namespace.py $(SCHEME) || exit 1; \
python3.7 test/check_symbol_namespace.py $(SCHEME) || exit 1; \
.PHONY: run-testvectors-all
run-testvectors-all: test/check_testvectors.py
@for scheme in $(ALL_SCHEMES); do \
python3 test/check_testvectors.py $$scheme || exit 1; \
python3.7 test/check_testvectors.py $$scheme || exit 1; \
done
.PHONY: run-symbol-namespace-all
run-symbol-namespace-all:
@for scheme in $(ALL_SCHEMES); do \
python3 test/check_symbol_namespace.py $$scheme || exit 1; \
python3.7 test/check_symbol_namespace.py $$scheme || exit 1; \
done
.PHONY: run-functest-all

Ver fichero

@ -16,8 +16,8 @@ SCHEMESHORT = SCHEME.split('/')[1].upper()
namespace = f"PQCLEAN_{SCHEMESHORT}_".replace('-', '')
# TODO can we do this using object files instead, to preserve file origin?
sharedlib = f"bin/shared_{SCHEMEFULL}_clean.so"
subprocess.run(["make", sharedlib, f"SCHEME={SCHEME}"])
sharedlib = "bin/shared_{}_clean.so".format(SCHEMEFULL)
subprocess.run(["make", sharedlib, "SCHEME={}".format(SCHEME)])
p = subprocess.run(["nm", "-D", sharedlib], capture_output=True)
symbols = p.stdout.decode('utf-8').strip().split("\n")
@ -31,7 +31,7 @@ for symbolstr in symbols:
if non_namespaced:
print("! Not all symbols were properly namespaced.", file=sys.stderr)
print(f"! Missing namespace literal {namespace}", file=sys.stderr)
print("! Missing namespace literal {}".format(namespace), file=sys.stderr)
for symbol in non_namespaced:
print(f"\t{symbol}", file=sys.stderr)
print("\t{}".format(symbol), file=sys.stderr)
sys.exit(1)

Ver fichero

@ -17,24 +17,26 @@ SCHEME = sys.argv[1]
SCHEMEFULL = SCHEME.replace('/', '_') # e.g. crypto_kem_kyber768
SCHEMESHORT = SCHEME.split('/')[1].upper()
def get_hash(scheme):
with open(f"{scheme}/META.yml", 'r') as stream:
with open("{}/META.yml".format(scheme), 'r') as stream:
meta = yaml.load(stream)
return hex(meta['testvectors-sha3-256']).replace('0x', '')
expectedTestvectorsHash = get_hash(SCHEME)
subprocess.run(["make", "testvectors", f"SCHEME={SCHEME}"])
implementations = [x for x in os.listdir('bin') if 'testvectors' in x and SCHEMEFULL in x]
subprocess.run(["make", "testvectors", "SCHEME={}".format(SCHEME)])
implementations = [
x for x in os.listdir('bin') if 'testvectors' in x and SCHEMEFULL in x]
for impl in implementations:
testvectors = subprocess.run([f"bin/{impl}"],stdout=subprocess.PIPE)
testvectors = subprocess.run(["bin/{}".format(impl)],
stdout=subprocess.PIPE)
testvectorsHash = hashlib.sha3_256(testvectors.stdout).hexdigest()
if testvectorsHash.lower() != expectedTestvectorsHash.lower():
print(f"testvectors of {SCHEME} should be {expectedTestvectorsHash}, but is {testvectorsHash}")
print("testvectors of {} should be {}, but is {}"
.format(SCHEME, expectedTestvectorsHash, testvectorsHash))
sys.exit(1)
else:
print(f"testvectors of {SCHEME} matched expected hash")
print("testvectors of {} matched expected hash".format(SCHEME))