Rahix / tbot

Automation/Testing tool for Embedded Linux Development
https://tbot.tools
GNU General Public License v3.0
86 stars 21 forks source link

Output form uboot_testpy for test requiring power cycling #32

Open xypron opened 3 years ago

xypron commented 3 years ago

The print out of the uboot_testpy target is messed up when sub-tests are requiring power cycling:

│   │    ## test/py/tests/test_efi_loader.py .sss.s│   ├─[rpi2] relay-card off
│   ├─[rpi2] relay-card off
│   ├─[rpi2] sd-mux-ctrl -v 0 -td
│   ├─[rpi2] relay-card on
                                [  0%]
│   │    ## test/py/tests/test_efi_selftest.py .│   ├─[rpi2] relay-card off
│   ├─[rpi2] relay-card off
│   ├─[rpi2] sd-mux-ctrl -v 0 -td
│   ├─[rpi2] relay-card on
.│   ├─[rpi2] relay-card off
│   ├─[rpi2] relay-card off
│   ├─[rpi2] sd-mux-ctrl -v 0 -td
│   ├─[rpi2] relay-card on
.│   ├─[rpi2] relay-card off
│   ├─[rpi2] relay-card off
│   ├─[rpi2] sd-mux-ctrl -v 0 -td
│   ├─[rpi2] relay-card on
.│   ├─[rpi2] relay-card off
│   ├─[rpi2] relay-card off
│   ├─[rpi2] sd-mux-ctrl -v 0 -td
│   ├─[rpi2] relay-card on
.                               [  0%]
│   │    ## test/py/tests/test_env.py ............sss

Can the output of poweron and poweroff be muted here?

Rahix commented 3 years ago

I know it looks ugly but I'd rather not hide the commands unconditionally. In case anything happens during their execution, it would be important to relay that information to the user. I think the proper solution here is what I've always dreaded: Properly parse incoming output and build up a kind of terminal emulator that parses control characters and escape sequences ... With such a foundation, correctly displaying interleaved command output should be much easier, but that's still quite some work ahead.

For now, if it bugs you too much, you could change your board config like this (not sure if I'd call this a good idea, though):

import tbot.log

# ...

    def poweron(self):
        v_saved = tbot.log.VERBOSITY
        tbot.log.VERBOSITY = tbot.log.Verbosity.QUIET

        self.host.exec0("relay-card", "off")
        self.host.exec0("sd-mux-ctrl", "-v", "0", "-td")
        time.sleep(3)
        self.host.exec0("relay-card", "on")

        tbot.log.VERBOSITY = v_saved

    def poweroff(self):
        v_saved = tbot.log.VERBOSITY
        tbot.log.VERBOSITY = tbot.log.Verbosity.QUIET

        self.host.exec0("relay-card", "off")

        tbot.log.VERBOSITY = v_saved