[tbot] Testcase example with board reboot

Harald Seiler hws at denx.de
Wed Nov 28 17:01:40 UTC 2018


Hi Stefano,

On Wed, 2018-11-28 at 17:39 +0100, Stefano Babic wrote:
> Hi,
> 
> is there an example where a testcase foresees a reboot ? Let's say, I
> acquire the board (linux), I do something on the board (ok, I update)
> and then I reboot again - after reboot I will check again.
> 
> Of course, until "reboot" is the standard way. Should I get a new context ?
> 
>     with contextlib.ExitStack() as cx:
>          if mach is None:
>              lh = cx.enter_context(tbot.acquire_lab())
>              b = cx.enter_context(tbot.acquire_board(lh))
>              lnx = cx.enter_context(tbot.acquire_linux(b))
>          else:
>              lnx = mach
> 
>              ......doing somethin
> 
> 	lnx.exec0("reboot")
> 
> 	???

To reboot, you have to reenter the board context.  In that case, having a `mach`
parameter is not a good idea, because the powercontrol should happen completely
inside your testcase.

An example can be found here:

	https://rahix.de/tbot/recipes.html#testcase-that-initializes-board

Note the outer context for the lab-host, which is not restarted and the inner
context for the board, which is destructed and rebuild again to reboot the
board (using a powercycle).

Hope this helps,
	Harald

> 
> Regards,
> Stefano
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-62  Fax: +49-8142-66989-80   Email: hws at denx.de


More information about the tbot mailing list