mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 23:48:58 +00:00
Test for symbolic links
We disallow symbolic links to ensure implementations are standalone and more portable.
This commit is contained in:
parent
17fb1be01c
commit
2fbd02a076
30
test/test_no_symlinks.py
Normal file
30
test/test_no_symlinks.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
"""
|
||||||
|
Checks that no implementation makes use of symbolic links.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import pqclean
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def test_no_symlinks():
|
||||||
|
for scheme in pqclean.Scheme.all_schemes():
|
||||||
|
for implementation in scheme.implementations:
|
||||||
|
yield check_no_symlinks, scheme.name, implementation.name
|
||||||
|
|
||||||
|
|
||||||
|
def check_no_symlinks(scheme_name, implementation_name):
|
||||||
|
implementation = pqclean.Implementation.by_name(
|
||||||
|
scheme_name, implementation_name)
|
||||||
|
for file in os.listdir(implementation.path()):
|
||||||
|
fpath = os.path.join(implementation.path(), file)
|
||||||
|
if os.path.islink(fpath):
|
||||||
|
raise AssertionError("{} is a symbolic link!".format(fpath))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
import nose2
|
||||||
|
nose2.main()
|
||||||
|
except ImportError:
|
||||||
|
import nose
|
||||||
|
nose.runmodule()
|
Loading…
Reference in New Issue
Block a user