Rahix/tbot

test/py test-framework hangs on some tests

Opened this issue · 2 comments



~/Documents/dmo-system-test$ python3 -m pytest -s --tbot-config config.serial_local_config  test_cases/test_uboot.py --html=report.html
========================================================= test session starts ==========================================================
platform linux -- Python 3.8.10, pytest-7.3.1, pluggy-1.0.0
rootdir: /home/adnanelhammoudi/Documents/dmo-system-test
plugins: metadata-3.0.0, xdist-3.5.0, html-4.1.1
collected 1 item                                                                                                                       

test_cases/test_uboot.py │   ├─Calling test_run_testpy ...
│   │   ├─[local] picocom --quiet -b 115200 -r -l /dev/ttyUSB2
│   │   ├─POWERON (imx8)
│   │   ├─UBOOT (device-u-boot)
│   │   │    <> 
│   │   │    <> 
│   │   │    <> <INTERRUPT>
│   │   │    <> => reboot
│   │   │    <> Unknown command 'reboot' - try 'help'
│   │   │    <> => cat
│   │   │    <> Unknown command 'cat' - try 'help'
│   │   │    <> => reset
│   │   │    <> resetting ...
│   │   │    <> 
│   │   │    <> 
│   │   │    <> U-Boot 2020.04.YodaPro-sma-20221215 (Dec 15 2022 - 20:08:00 +0000)
│   │   │    <> 
│   │   │    <> CPU:   NXP i.MX8DXL RevA1 A35 at 1200 MHz at 45C
│   │   │    <> 
│   │   │    <> DRAM:  1022 MiB
│   │   │    <> MMC:   FSL_SDHC: 0
│   │   │    <> Loading Environment from MMC... OK
│   │   │    <> In:    serial
│   │   │    <> Out:   serial
│   │   │    <> Err:   serial
│   │   │    <> Model: SMA YODAPRO
│   │   │    <> Board: VS-YODA-PRO-COM
│   │   │    <> DISP:  not found
│   │   │    <> sc_seco_v2x_build_info: res:8
│   │   │    <> 
│   │   │    <>  BuildInfo: 
│   │   │    <>   - SCFW cae076f8, SECO-FW b6fcc2c6, IMX-MKIMAGE f3335e39, ATF lf-5.15
│   │   │    <>   - U-Boot 2020.04.YodaPro-sma-20221215 
│   │   │    <> 
│   │   │    <> flash target is MMC:0
│   │   │    <> Net:   eth0: ethernet@5b050000
│   │   │    <> Fastboot: Normal
│   │   │    <> Normal Boot
│   │   │    <> Press SPACE to abort autoboot in 3 seconds
│   │   │    <> =>  
│   │   ├─[local] mkdir -p /home/adnanelhammoudi/Documents
│   │   ├─Calling uboot_testpy ...
│   │   │   ├─[local] bash --norc --noprofile
│   │   │   ├─Calling uboot_setup_testhooks ...
│   │   │   │   ├─[local] test -d /home/adnanelhammoudi/Documents/uboot-testpy-tbot
│   │   │   │   ├─Creating FIFOs ...
│   │   │   │   ├─[local] rm -rf /home/adnanelhammoudil/Documents/uboot-testpy-tbot/fifo_console_send
│   │   │   │   ├─[local] mkfifo /home/adnanelhammoudi/Documents/uboot-testpy-tbot/fifo_console_send
│   │   │   │   ├─[local] rm -rf /home/adnanelhammoudi/Documents/uboot-testpy-tbot/fifo_console_recv
│   │   │   │   ├─[local] mkfifo /home/adnanelhammoudi/Documents/uboot-testpy-tbot/fifo_console_recv
│   │   │   │   ├─[local] rm -rf /home/adnanelhammoudi/Documents/uboot-testpy-tbot/fifo_commands
│   │   │   │   ├─[local] mkfifo /home/adnanelhammoudi/Documents/uboot-testpy-tbot/fifo_commands
│   │   │   │   ├─[local] cat /home/adnanelhammoudi/Documents/uboot-testpy-tbot/tbot-scripts.sha256
│   │   │   │   │    ## 2d30892b61eb713ce9413e06c4f2a0cd00d2a74b6b8c2ac6624e1e49909b1897
│   │   │   │   ├─Hooks are up to date, skipping deployment ...
│   │   │   │   ├─Adding hooks to $PATH ...
│   │   │   │   ├─[local] echo " ${PATH}"
│   │   │   │   │    ##  /home/adnanelhammoudi/Documents/dmo-system-test/scripts/env/bin:/home/adnanelhammoudi/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
│   │   │   │   ├─[local] export PATH=/home/adnanelhammoudil/Documents/uboot-testpy-tbot:/home/adnanelhammoudi/Documents/dmo-system-test/scripts/env/bin:/home/adnanelhammoudi/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
│   │   │   │   ├─Open console & command channels ...
│   │   │   │   ├─[local] /home/adnanelhammoudi/Documents/uboot-testpy-tbot/tbot-console
│   │   │   │   ├─[local] /home/adnanelhammoudi/Documents/uboot-testpy-tbot/tbot-commands
│   │   │   │   └─Done. (0.030s)
│   │   │   ├─[local] test -e /home/adnanelhammoudi/Documents/u-boot/.config
│   │   │   ├─[local] test -e /home/adnanelhammoudi/Documents/u-boot/include/autoconf.mk
│   │   │   ├─[local] printf %s '' >/home/adnanelhammoudi/Documents/u-boot/test/py/u_boot_boardenv_tbot_imx8.py
│   │   │   ├─[local] cd /home/adnanelhammoudi/Documents/u-boot
│   │   │   ├─[local] ./test/py/test.py --build-dir . --board-type tbot-imx8
│   │   │   │    ## +u-boot-test-flash tbot-imx8 na
│   │   │   │    ## ================================= test session starts ==================================
│   │   │   │    ## platform linux -- Python 3.8.10, pytest-7.3.1, pluggy-1.0.0
│   │   │   │    ## rootdir: /home/adnanelhammoudi/Documents/u-boot/test/py
│   │   │   │    ## configfile: pytest.ini
│   │   │   │    ## plugins: metadata-3.0.0, xdist-3.5.0, html-4.1.1
│   │   │   │    ## collected 429 items                                                                    
│   │   │   │    ## 
│   │   │   │    ## test/py/tests/test_000_version.py 
│   │   │   └─Fail. (31.088s)
│   │   ├─POWEROFF (imx8q)
│   │   └─Fail. (34.379s)
FAILED

============================================================================= FAILURES =============================================================================
_________________________________________________________________________ test_run_testpy __________________________________________________________________________

    @tbot.testcase
    def test_run_testpy():
        with tbot.ctx() as cx:
            lb = cx.request(tbot.role.LocalHost)
            b = cx.request(tbot.role.Board)
            ub = cx.request(tbot.role.BoardUBoot)
            build_dir = lb.workdir
>           uboot.testpy(
            build_dir,
            boardenv=BOARDENV,
            board=b,
            uboot=ub,
            testpy_args=["-k", "not (clean  or dm or efi or env or hashes or gpt or help or hush or gpio or net or md or part or pinmux or shell or sleep)"],)

test_cases/test_uboot.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../.local/lib/python3.8/site-packages/tbot/decorators.py:92: in wrapped
    return tc(*args, **kwargs)
../../.local/lib/python3.8/site-packages/tbot_contrib/uboot/_testpy.py:343: in testpy
    b.poweron()
config/serial_local_config.py:46: in poweron
    self.ch.sendcontrol("C")
../../.local/lib/python3.8/site-packages/tbot/machine/channel/channel.py:705: in sendcontrol
    self.write(bytes([num]), _ignore_blacklist=True)
../../.local/lib/python3.8/site-packages/tbot/machine/channel/channel.py:342: in write
    bytes_written = self._c.write(buf[cursor:])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tbot.machine.channel.channel.ChannelBorrowed object at 0x7fe7dbdbeb50>, buf = b'\x03'

    def write(self, buf: bytes) -> int:
>       raise self.exception()
E       tbot.error.ChannelBorrowedError: channel is currently borrowed by another machine

../../.local/lib/python3.8/site-packages/tbot/machine/channel/channel.py:159: ChannelBorrowedError
------------------------- Generated html report: file:///home/adnanelhammoudi%40digitalgateamg.local/Documents/dmo-system-test/report.html -------------------------
===================================================================== short test summary info ======================================================================
FAILED test_cases/test_uboot.py::test_run_testpy - tbot.error.ChannelBorrowedError: channel is currently borrowed by another machine
======================================================================== 1 failed in 34.48s =======================================================================

I have updated the logs, it raised an error after 34 s indicating that the channel has been borrowed!

it seems the other tests in test/py framework won't run due to the source code of u-boot not including some menu config configurations, since each test has its fixture, but tbot can't skip the test or raise a warning instead.