Skip to content

Commit

Permalink
XX
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
  • Loading branch information
mballance committed Sep 5, 2024
1 parent 20dd951 commit 2c4ac60
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ivpm.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

package:
name: pytest-hdl
name: pytest-fv

# setup-deps:
#- ninja
Expand Down
16 changes: 12 additions & 4 deletions src/pytest_fv/dirconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@

class DirConfig(object):

def __init__(self, request : pytest.FixtureRequest):
def __init__(self,
request : pytest.FixtureRequest,
pytestconfig : pytest.Config):
from .fv_config import FvConfig
self._cfg = FvConfig.inst(pytestconfig)
self.request = request
self._rundir = os.path.join(os.getcwd(), "rundir")
self._rundir = os.path.join(self._cfg.rootdir, "rundir")

@property
def config(self) -> 'pytest_fv.FvConfig':
return self._cfg

def builddir(self, name="build"):
return os.path.join(self._rundir, name)
Expand All @@ -28,5 +36,5 @@ def mkBuildDirFile(self, path, content):


@pytest.fixture
def dirconfig(request):
return DirConfig(request)
def dirconfig(request, pytestconfig):
return DirConfig(request, pytestconfig)
14 changes: 10 additions & 4 deletions src/pytest_fv/fv_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import configparser

class FvConfig(object):
DEFAULT_TOOL_HDLSIM = "xsm"
DEFAULT_TOOL_HDLSIM = "vlt"

_inst = None

Expand All @@ -35,15 +35,21 @@ def __init__(self, pytestconfig):
self.ini = configparser.ConfigParser()
self.ini.read(pytestconfig.inipath)
self._have_ini = True
self._rootdir = pytestconfig.rootpath
else:
self._rootdir = os.getcwd()
self.ini = {}

pass

@property
def rootdir(self):
return self._rootdir

def _pytest_hdl(self):
if "pytest-fv" not in self.ini.keys():
self.ini["pytest-fv"] = {}
return self.ini["pytest-fv"]
if "pytest.fv" not in self.ini.keys():
self.ini["pytest.fv"] = {}
return self.ini["pytest.fv"]

def getHdlSim(self):
pytest_hdl = self._pytest_hdl()
Expand Down
1 change: 1 addition & 0 deletions src/pytest_fv/impl/path_src_ivpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, test_srcdir):

# Find the project
project = find_project_root(test_srcdir)
print("project: %s" % project)
self.pkg_info = load_project_package_info(project)

self.pkg_info_rgy = PkgInfoRgy.inst()
Expand Down
2 changes: 2 additions & 0 deletions src/pytest_fv/tool/hdl/sim/sim_verilator.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ async def run(self, run_args : HdlSim.RunArgs):
if not os.path.isdir(os.path.dirname(logfile)):
os.makedirs(os.path.dirname(logfile))

cmd.extend(run_args.plusargs)

with open(logfile, "w") as log:
log.write("** Command: %s\n" % str(cmd))
log.write("** CWD: %s\n" % run_args.rundir)
Expand Down

0 comments on commit 2c4ac60

Please sign in to comment.