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.
 
 
 

43 regels
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. @helpers.slow_test
  14. @helpers.filtered_test
  15. def check_valgrind(implementation: pqclean.Implementation):
  16. if (platform.machine() not in ('i386', 'x86_64') or
  17. platform.system() != 'Linux'):
  18. raise unittest.SkipTest()
  19. helpers.make(TYPE=implementation.scheme.type,
  20. SCHEME=implementation.scheme.name,
  21. IMPLEMENTATION=implementation.name,
  22. working_dir=os.path.join('..', 'test'))
  23. functest_name = './functest_{}_{}'.format(implementation.scheme.name,
  24. implementation.name)
  25. helpers.run_subprocess(['valgrind', functest_name],
  26. os.path.join('..', 'bin'))
  27. if __name__ == '__main__':
  28. try:
  29. import nose2
  30. nose2.main()
  31. except ImportError:
  32. import nose
  33. nose.runmodule()