Reference implementations of PQC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
1.1 KiB

  1. """
  2. Runs the test files under valgrind to detect memory problems
  3. """
  4. import os
  5. import platform
  6. import unittest
  7. import pqclean
  8. import helpers
  9. def test_functest():
  10. for scheme in pqclean.Scheme.all_schemes():
  11. for implementation in scheme.implementations:
  12. yield check_valgrind, implementation
  13. def check_valgrind(implementation: pqclean.Implementation):
  14. if (platform.machine() not in ('i386', 'x86_64') or
  15. platform.system() != 'Linux'):
  16. raise unittest.SkipTest()
  17. helpers.make(TYPE=implementation.scheme.type,
  18. SCHEME=implementation.scheme.name,
  19. IMPLEMENTATION=implementation.name,
  20. working_dir=os.path.join('..', 'test'))
  21. functest_name = './functest_{}_{}'.format(implementation.scheme.name,
  22. implementation.name)
  23. helpers.run_subprocess(['valgrind', functest_name],
  24. os.path.join('..', 'bin'))
  25. if __name__ == '__main__':
  26. try:
  27. import nose2
  28. nose2.main()
  29. except ImportError:
  30. import nose
  31. nose.runmodule()