Skip to content
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

cocotb_test/simulator.py: fix exit gracefully #141

Merged
merged 1 commit into from
May 8, 2021

Conversation

akukulanski
Copy link
Contributor

Hi,
This small fix avoids the exception during the call to exit_gracefully() and prevents the simulator to keep running in the background after sensing a SIGINT.

================================================================================================================= FAILURES =================================================================================================================
_____________________________________________________________________________________________________________ test_axi_device ______________________________________________________________________________________________________________

self = <nmigen_cocotb.Icarus_g2005 object at 0x7ff14b667100>
cmds = [['iverilog', '-o', '/tmp/tmphv4tc1qb/top.vvp', '-D', 'COCOTB_SIM=1', '-s', ...], ['vvp', '-M', 'xxx...sim-model/test_venv/lib/python3.9/site-packages/cocotb/libs', '-m', 'libcocotbvpi_icarus', '/tmp/tmphv4tc1qb/top.vvp']]

    def execute(self, cmds):
        self.set_env()
        for cmd in cmds:
            self.logger.info("Running command: " + " ".join(cmd))
    
            with subprocess.Popen(
                cmd,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                cwd=self.work_dir,
                env=self.env
            ) as p:
>               for line in p.stdout:

test_venv/lib/python3.9/site-packages/cocotb_test/simulator.py:263: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nmigen_cocotb.Icarus_g2005 object at 0x7ff14b667100>, signum = 2
frame = <frame at 0x7ff14b7879f0, file 'xxx...sim-model/test_venv/lib/python3.9/site-packages/cocotb_test/simulator.py', line 264, code execute>

    def exit_gracefully(self, signum, frame):
        pid = None
>       if self.process is not None:
E       AttributeError: 'Icarus_g2005' object has no attribute 'process'

test_venv/lib/python3.9/site-packages/cocotb_test/simulator.py:296: AttributeError

@themperek themperek merged commit 207ad7f into themperek:master May 8, 2021
@themperek
Copy link
Owner

Thank you!

@akukulanski akukulanski deleted the fix-exit-gracefully branch May 8, 2021 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants