diff mbox series

[23/42] test: Release board after tests complete

Message ID 20240611200156.2245525-24-sjg@chromium.org
State Changes Requested
Delegated to: Tom Rini
Headers show
Series labgrid: Provide an integration with Labgrid | expand

Commit Message

Simon Glass June 11, 2024, 8:01 p.m. UTC
When a board is finished with, the lab may want to power it off, or
perform some other function. Add a new script which is called when tests
are complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/py/u_boot_console_exec_attach.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Tom Rini June 12, 2024, 4:02 p.m. UTC | #1
On Tue, Jun 11, 2024 at 02:01:37PM -0600, Simon Glass wrote:

> When a board is finished with, the lab may want to power it off, or
> perform some other function. Add a new script which is called when tests
> are complete.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  test/py/u_boot_console_exec_attach.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Given that all of my wrapper scripts include a "turn it all on" and then
catch for "turn everything off", this sounds very handy.
Simon Glass June 12, 2024, 8:24 p.m. UTC | #2
Hi Tom,

On Wed, 12 Jun 2024 at 10:02, Tom Rini <trini@konsulko.com> wrote:
>
> On Tue, Jun 11, 2024 at 02:01:37PM -0600, Simon Glass wrote:
>
> > When a board is finished with, the lab may want to power it off, or
> > perform some other function. Add a new script which is called when tests
> > are complete.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  test/py/u_boot_console_exec_attach.py | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
>
> Given that all of my wrapper scripts include a "turn it all on" and then
> catch for "turn everything off", this sounds very handy.

Yes I ruined some batteries due to lack of this.

I also added a way to tell Labgrid the end state to move to, which
also manages to turn off the board, unless something goes wrong in
Labgrid.

Regards,
Simon
diff mbox series

Patch

diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py
index 8dd8cc1230c..5f4916b7da2 100644
--- a/test/py/u_boot_console_exec_attach.py
+++ b/test/py/u_boot_console_exec_attach.py
@@ -70,3 +70,13 @@  class ConsoleExecAttach(ConsoleBase):
             raise
 
         return s
+
+    def close(self):
+        super().close()
+
+        self.log.action('Releasing board')
+        args = [self.config.board_type, self.config.board_identity]
+        cmd = ['u-boot-test-release'] + args
+        runner = self.log.get_runner(cmd[0], sys.stdout)
+        runner.run(cmd)
+        runner.close()