tbot icon indicating copy to clipboard operation
tbot copied to clipboard

Test case with picocom channel fails with "some subprocess(es) did not stop"

Open VictorEmelin opened this issue 8 months ago • 3 comments

Very simple test case fails with error:

$ newbot ts.hello_world.hi -c config.temp_config tbot starting ... ├─Calling hi ... │ ├─[local] picocom -b 115200 /dev/ttyUSB1 │ ├─[dm-board-linux] echo Hello World │ │ ## Hello World │ ├─test case finished │ └─Fail. (1.717s) ├─Warning: Found dangling <class 'config.temp_config.DmBoardLinux'> instance in this context ├─Warning: Found dangling <class 'config.temp_config.DmBoard'> instance in this context ├─Warning: Teardown went wrong! A <class 'config.temp_config.DmBoardLinux'> instance is still alive. │ Please report this to https://github.com/rahix/tbot/issues! ├─Warning: Teardown went wrong! A <class 'config.temp_config.DmBoard'> instance is still alive. │ Please report this to https://github.com/rahix/tbot/issues! ├─Exception: │ Traceback (most recent call last): │ File "/usr/lib/python3.8/contextlib.py", line 510, in exit │ if cb(*exc_details): │ File "/usr/lib/python3.8/contextlib.py", line 120, in exit │ next(self.gen) │ File "/home/vemelin/.local/lib/python3.8/site-packages/tbot/machine/connector/common.py", line 132, in _connect │ yield ch │ File "/home/vemelin/.local/lib/python3.8/site-packages/tbot/machine/channel/channel.py", line 561, in exit │ self.close() │ File "/home/vemelin/.local/lib/python3.8/site-packages/tbot/machine/channel/channel.py", line 538, in close │ self._c.close() │ File "/home/vemelin/.local/lib/python3.8/site-packages/tbot/machine/channel/subprocess.py", line 130, in close │ raise tbot.error.TbotException("some subprocess(es) did not stop") │ tbot.error.TbotException: some subprocess(es) did not stop ├───────────────────────────────────────── └─FAILURE (1.789s)

code hello_world.py:

import tbot


@tbot.testcase
def hi():
    with tbot.ctx.request(tbot.role.BoardLinux) as lnx:
        lnx.exec0("echo",
                  "Hello",
                  "World")
        tbot.log.message(f"test case finished")

code temp_config.py:

import tbot
from tbot.machine import connector, board, linux


class DmBoard(connector.ConsoleConnector, board.Board):
    baudrate = 115200
    serial_port = "/dev/ttyUSB1"

    def connect(self, mach):
        return mach.open_channel("picocom", "-b", str(self.baudrate), self.serial_port)


class DmBoardLinux(board.Connector, linux.Ash):
    pass


def register_machines(ctx: tbot.Context):
    ctx.register(DmBoard, tbot.role.Board)
    ctx.register(DmBoardLinux, tbot.role.BoardLinux)

VictorEmelin avatar Jun 14 '24 14:06 VictorEmelin