Merge pull request #566 from antmicro/umarcor/envvars

f4pga/wrappers/sh: do not require F4PGA_ENV_* envvars as long as F4PGA_INSTALL_DIR is defined
This commit is contained in:
Tomasz Michalak 2022-05-31 08:11:56 +02:00 committed by GitHub
commit 297978cb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 19 deletions

View File

@ -24,15 +24,28 @@ from pathlib import Path
from subprocess import check_call
f4pga_environ = environ.copy()
ROOT = Path(__file__).resolve().parent
F4PGA_FAM = environ.get('F4PGA_FAM', 'xc7')
SH_SUBDIR = 'quicklogic' if F4PGA_FAM == 'eos-s3' else F4PGA_FAM
F4PGA_FAM = f4pga_environ.get('F4PGA_FAM', 'xc7')
isQuickLogic = F4PGA_FAM == 'eos-s3'
SH_SUBDIR = 'quicklogic' if isQuickLogic else F4PGA_FAM
F4PGA_INSTALL_DIR = f4pga_environ.get('F4PGA_INSTALL_DIR')
if F4PGA_INSTALL_DIR is None:
raise(Exception("Required environment variable F4PGA_INSTALL_DIR is undefined!"))
F4PGA_INSTALL_DIR_PATH = Path(F4PGA_INSTALL_DIR)
f4pga_environ['F4PGA_ENV_BIN'] = f4pga_environ.get('F4PGA_ENV_BIN', str(F4PGA_INSTALL_DIR_PATH / F4PGA_FAM / 'conda/bin'))
f4pga_environ['F4PGA_ENV_SHARE'] = f4pga_environ.get('F4PGA_ENV_SHARE', str(F4PGA_INSTALL_DIR_PATH / F4PGA_FAM / (
'share' if isQuickLogic else 'install/share/symbiflow'
)))
def run_sh(script):
stdout.flush()
stderr.flush()
check_call([str(script)]+sys_argv[1:])
check_call([str(script)]+sys_argv[1:], env=f4pga_environ)
def generate_constraints():

View File

@ -1,28 +1,31 @@
from os import environ
from pytest import mark
from sys import stdout, stderr
from subprocess import check_call
wrappers = [
'symbiflow_generate_constraints',
'symbiflow_pack',
'symbiflow_place',
'symbiflow_route',
'symbiflow_synth',
'symbiflow_write_bitstream',
'symbiflow_write_fasm',
'symbiflow_write_xml_rr_graph',
'vpr_common',
'symbiflow_analysis',
'symbiflow_repack',
'symbiflow_generate_bitstream',
'symbiflow_generate_libfile',
'ql_symbiflow'
]
@mark.xfail
@mark.parametrize(
"wrapper",
[
'symbiflow_generate_constraints',
'symbiflow_pack',
'symbiflow_place',
'symbiflow_route',
'symbiflow_synth',
'symbiflow_write_bitstream',
'symbiflow_write_fasm',
'symbiflow_write_xml_rr_graph',
'vpr_common',
'symbiflow_analysis',
'symbiflow_repack',
'symbiflow_generate_bitstream',
'symbiflow_generate_libfile',
'ql_symbiflow'
]
wrappers
)
def test_shell_wrapper(wrapper):
print(f"\n::group::Test {wrapper}")
@ -32,3 +35,20 @@ def test_shell_wrapper(wrapper):
check_call(f"{wrapper}")
finally:
print("\n::endgroup::")
@mark.xfail
@mark.parametrize(
"wrapper",
wrappers
)
def test_shell_wrapper_without_F4PGA_INSTALL_DIR(wrapper):
test_environ = environ.copy()
del test_environ['F4PGA_INSTALL_DIR']
print(f"\n::group::Test {wrapper}")
stdout.flush()
stderr.flush()
try:
check_call(f"{wrapper}", env=test_environ)
finally:
print("\n::endgroup::")