mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-12-07 00:02:12 -05:00
Fix test_alg_info.py on Windows platform (#1821)
* Fix test_alg_info.py on Windows platform Signed-off-by: zinag <uzinag@163.com> * Remove incorrect print Signed-off-by: zinag <uzinag@163.com> --------- Signed-off-by: zinag <uzinag@163.com>
This commit is contained in:
parent
6ee5de2522
commit
c8a2beb5a6
@ -16,7 +16,11 @@ def test_alg_info_kem(kem_name):
|
||||
alg_info = yaml.safe_load(output)['KEMs'][kem_name]
|
||||
assert(not(alg_info['isnull']))
|
||||
# find and load the datasheet
|
||||
datasheet_filename = helpers.run_subprocess(['grep', '-r', '-l', kem_name, 'docs/algorithms/kem']).splitlines()[0]
|
||||
if platform.system() == 'Windows':
|
||||
command = f"Select-String -Path 'docs/algorithms/kem/*' -Pattern '{kem_name}' -SimpleMatch -List | Select-Object -ExpandProperty Path"
|
||||
datasheet_filename = helpers.run_subprocess(['powershell', '-Command', command]).splitlines()[0]
|
||||
else:
|
||||
datasheet_filename = helpers.run_subprocess(['grep', '-r', '-l', kem_name, 'docs/algorithms/kem']).splitlines()[0]
|
||||
datasheet_filename = datasheet_filename.replace('.md','.yml')
|
||||
with open(datasheet_filename, 'r', encoding='utf8') as datasheet_fh:
|
||||
datasheet = yaml.safe_load(datasheet_fh.read())
|
||||
@ -45,7 +49,11 @@ def test_alg_info_sig(sig_name):
|
||||
alg_info = yaml.safe_load(output)['SIGs'][sig_name]
|
||||
assert(not(alg_info['isnull']))
|
||||
# find and load the datasheet
|
||||
datasheet_filename = helpers.run_subprocess(['grep', '-r', '-l', sig_name, 'docs/algorithms/sig']).splitlines()[0]
|
||||
if platform.system() == 'Windows':
|
||||
command = f"Select-String -Path 'docs/algorithms/sig/*' -Pattern '{sig_name}' -SimpleMatch -List | Select-Object -ExpandProperty Path"
|
||||
datasheet_filename = helpers.run_subprocess(['powershell', '-Command', command]).splitlines()[0]
|
||||
else:
|
||||
datasheet_filename = helpers.run_subprocess(['grep', '-r', '-l', sig_name, 'docs/algorithms/sig']).splitlines()[0]
|
||||
datasheet_filename = datasheet_filename.replace('.md','.yml')
|
||||
with open(datasheet_filename, 'r', encoding='utf8') as datasheet_fh:
|
||||
datasheet = yaml.safe_load(datasheet_fh.read())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user