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.
 
 
 
 

48 lines
1.1 KiB

  1. import os
  2. import platform
  3. import unittest
  4. from glob import glob
  5. import pytest
  6. import helpers
  7. import pqclean
  8. additional_flags = [] #['-fix-errors']
  9. @pytest.mark.parametrize(
  10. 'implementation',
  11. pqclean.Scheme.all_supported_implementations(),
  12. ids=str,
  13. )
  14. @helpers.skip_windows()
  15. @helpers.filtered_test
  16. def test_clang_tidy(implementation: pqclean.Implementation):
  17. helpers.ensure_available('clang-tidy')
  18. cfiles = implementation.cfiles()
  19. common_files = glob(os.path.join('..', 'common', '*.c'))
  20. (returncode, _) = helpers.run_subprocess(
  21. ['clang-tidy',
  22. '-quiet',
  23. '-header-filter=.*',
  24. *additional_flags,
  25. *cfiles,
  26. *common_files,
  27. '--',
  28. '-iquote', os.path.join('..', 'common'),
  29. '-iquote', implementation.path()],
  30. expected_returncode=None,
  31. )
  32. # Detect and gracefully avoid segfaults
  33. if returncode == -11:
  34. raise unittest.SkipTest("clang-tidy segfaulted")
  35. assert returncode == 0, "Clang-tidy returned %d" % returncode
  36. if __name__ == "__main__":
  37. import sys
  38. pytest.main(sys.argv)