2019-03-01 10:44:22 +00:00
|
|
|
import os
|
|
|
|
from glob import glob
|
2019-03-01 11:22:33 +00:00
|
|
|
import shutil
|
|
|
|
import unittest
|
2019-03-01 10:44:22 +00:00
|
|
|
|
|
|
|
import pqclean
|
|
|
|
from helpers import run_subprocess
|
|
|
|
|
|
|
|
|
|
|
|
def test_clang_tidy():
|
|
|
|
for scheme in pqclean.Scheme.all_schemes():
|
|
|
|
for implementation in scheme.implementations:
|
|
|
|
yield check_tidy, implementation
|
|
|
|
|
|
|
|
|
|
|
|
def check_tidy(implementation: pqclean.Implementation):
|
2019-03-01 11:22:33 +00:00
|
|
|
if shutil.which('clang-tidy') is None:
|
|
|
|
raise unittest.SkipTest("clang-tidy unavailable in PATH")
|
2019-03-01 10:44:22 +00:00
|
|
|
cfiles = glob(os.path.join(implementation.path(), '*.c'))
|
|
|
|
common_files = glob(os.path.join('..', 'common', '*.c'))
|
|
|
|
run_subprocess(['clang-tidy',
|
|
|
|
'-quiet',
|
|
|
|
'-header-filter=.*',
|
|
|
|
*cfiles,
|
|
|
|
*common_files,
|
|
|
|
'--',
|
|
|
|
'-iquote', os.path.join('..', 'common'),
|
|
|
|
'-iquote', implementation.path(),
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
try:
|
|
|
|
import nose2
|
|
|
|
nose2.main()
|
|
|
|
except ImportError:
|
|
|
|
import nose
|
|
|
|
nose.runmodule()
|