From 530c694c450e5b98c50ea5b1201df474bc952ca9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 12 Nov 2024 07:13:16 -0700 Subject: test: Release board after tests complete 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. Reviewed-by: Tom Rini Signed-off-by: Simon Glass --- test/py/u_boot_console_exec_attach.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/py/u_boot_console_exec_attach.py') 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() -- cgit v1.2.3 From 6f3583074fc05e16ca8a0244aa7bf6e634e7d6df Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 12 Nov 2024 07:13:17 -0700 Subject: test: Allow connecting to a running board Sometimes we know that the board is already running the right software, so provide an option to allow running of tests directly, without first resetting the board. This saves time when re-running a test where only the Python code is changing. Note that this feature is open to errors, since the user must know that the board is in a fit state to execute tests. It is useful for repeated iteration on a particular test, where it can save quite a bit of time. Signed-off-by: Simon Glass --- test/py/u_boot_console_exec_attach.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'test/py/u_boot_console_exec_attach.py') diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py index 5f4916b7da2..8b253b4451d 100644 --- a/test/py/u_boot_console_exec_attach.py +++ b/test/py/u_boot_console_exec_attach.py @@ -59,15 +59,18 @@ class ConsoleExecAttach(ConsoleBase): args = [self.config.board_type, self.config.board_identity] s = Spawn(['u-boot-test-console'] + args) - try: - self.log.action('Resetting board') - cmd = ['u-boot-test-reset'] + args - runner = self.log.get_runner(cmd[0], sys.stdout) - runner.run(cmd) - runner.close() - except: - s.close() - raise + if self.config.use_running_system: + self.log.action('Connecting to board without reset') + else: + try: + self.log.action('Resetting board') + cmd = ['u-boot-test-reset'] + args + runner = self.log.get_runner(cmd[0], sys.stdout) + runner.run(cmd) + runner.close() + except: + s.close() + raise return s -- cgit v1.2.3