New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate build and test for python runner #2853
Conversation
Maybe should rise exception if not provided or default? |
d105c1c
to
ecc7150
Compare
Maybe can add something like "self.did_build" and based on this require some extra settings or return warnings? |
e06ee14
to
cedb03b
Compare
This is exactly why I didn't like the current approach where all the options were heaped into the Simulator object. |
cedb03b
to
777d3b9
Compare
I guess everything will have its pros and cons. I removed |
777d3b9
to
97d8f7f
Compare
Codecov Report
@@ Coverage Diff @@
## master #2853 +/- ##
==========================================
+ Coverage 71.96% 72.13% +0.16%
==========================================
Files 47 47
Lines 8437 8440 +3
Branches 1455 1453 -2
==========================================
+ Hits 6072 6088 +16
+ Misses 1953 1940 -13
Partials 412 412
Continue to review full report at Codecov.
|
If we moved to @pytest.fixture(scope="session")
def simulator():
return get_runner(sim)()
@pytest.fixture(scope="session")
def build(simulator):
return runner.build(
always=True,
verilog_sources=verilog_sources,
vhdl_sources=vhdl_sources,
toplevel=toplevel,
build_dir=sim_build,
extra_args=compile_args,
)
@pytest.mark.parametrize("seed", list(range(4)))
def test_cocotb_parallel(seed, simulator, build):
simulator.test(
build=build, # pass build object here
toplevel=toplevel,
python_search=python_search,
py_module=module_name,
seed=seed,
) |
If you use pytest-xdist it will compile in every thread (if you span 4 runners fixture will run 4 times). This is also a use case but ... |
It looks like many people are interested in such a feature, but they have put no effort into implementing it, even though they have a potential viable design. pytest-dev/pytest-xdist#271. The current approach only works if you are running xdist tests locally. Builds should be done per node, but per worker may be fine, it consumes N disk space vs 1, but should take the same amount of wall time for the test to complete since it's all happening in parallel. |
97d8f7f
to
c649535
Compare
I have lost hope we will have the perfect solution. Just some solution. As it is in this PR would give full flexibility if needed. |
c649535
to
0cfd080
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure we track the fact we need documentation for this once it's all complete and we are happy with it.
I probably should add a mypy check for the files that are checkable. We need to first decide if that is a goal, or if that should all be handled with cocotb-stubs. |
Ability to “easy” parallel runs
0cfd080
to
a425385
Compare
This allows to run the parallel example with
pytest-xdist
:pytest -m compile pytest -m "not compile" -n auto
Not sure if we should put all those arguments intest()
like withbuild_dir
,library_name
orparameters
? @ktbarrettNeed to add some optional arguments to
test()
build_dir
library_name
-> needed for Icarus executable file name could use some generic name and not touch this.parameters
-> needed for GHDL/Questa/Riviera