mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-26 17:31:38 +00:00
78a65d6ec9
* Do tests with pytest to run them in parallel * attempt to handle merge commits better for PR test path Similar to how we solved this for travis * Clean up imports * don't run valgrind if not specified slow_test * Fix functest after initializer rename * upload tests results as junit * Upload test-common files since #200 got merged * Catch test results upload failure
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""
|
|
Runs the test files under valgrind to detect memory problems
|
|
"""
|
|
|
|
import os
|
|
import platform
|
|
import unittest
|
|
|
|
import pytest
|
|
|
|
import helpers
|
|
import pqclean
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
'implementation,test_dir,impl_path, init, destr',
|
|
[(impl, *helpers.isolate_test_files(impl.path(), 'test_functest_'))
|
|
for impl in pqclean.Scheme.all_implementations()],
|
|
ids=[str(impl) for impl in pqclean.Scheme.all_implementations()],
|
|
)
|
|
@helpers.slow_test
|
|
@helpers.filtered_test
|
|
def test_valgrind(implementation: pqclean.Implementation, impl_path, test_dir,
|
|
init, destr):
|
|
if (platform.machine() not in ('i386', 'x86_64') or
|
|
platform.system() != 'Linux'):
|
|
raise unittest.SkipTest()
|
|
init()
|
|
|
|
dest_dir = os.path.join(test_dir, 'bin')
|
|
|
|
helpers.make(TYPE=implementation.scheme.type,
|
|
SCHEME=implementation.scheme.name,
|
|
SCHEME_DIR=os.path.abspath(impl_path),
|
|
IMPLEMENTATION=implementation.name,
|
|
DEST_DIR=dest_dir,
|
|
working_dir=os.path.join(test_dir, 'test'))
|
|
functest_name = './functest_{}_{}'.format(implementation.scheme.name,
|
|
implementation.name)
|
|
helpers.run_subprocess(['valgrind', functest_name], dest_dir)
|
|
destr()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
import sys
|
|
pytest.main(sys.argv)
|