tbot icon indicating copy to clipboard operation
tbot copied to clipboard

Output form uboot_testpy for test requiring power cycling

Open xypron opened this issue 3 years ago • 1 comments

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?

xypron avatar Oct 11 '20 10:10 xypron

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

Rahix avatar Oct 13 '20 08:10 Rahix