mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-27 09:51:30 +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
34 lines
884 B
Python
34 lines
884 B
Python
import pytest
|
|
|
|
import helpers
|
|
import pqclean
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
'implementation',
|
|
pqclean.Scheme.all_implementations(),
|
|
ids=str,
|
|
)
|
|
@helpers.filtered_test
|
|
def test_preprocessor(implementation: pqclean.Implementation):
|
|
cfiles = implementation.cfiles()
|
|
hfiles = implementation.hfiles()
|
|
errors = []
|
|
for file in hfiles + cfiles:
|
|
with open(file) as f:
|
|
for i, line in enumerate(f):
|
|
line = line.strip()
|
|
if file in hfiles and i == 0 and line.startswith('#ifndef'):
|
|
continue
|
|
if line.startswith('#if'):
|
|
errors.append("\n at {}:{}".format(file, i+1))
|
|
if errors:
|
|
raise AssertionError(
|
|
"Prohibited use of preprocessor conditional" + "".join(errors)
|
|
)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
import sys
|
|
pytest.main(sys.argv)
|