summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBobby Casey <bobbycasey@google.com>2022-12-21 15:54:50 -0500
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-07 18:42:33 +0000
commitd9b9cb6e89a9d3082421e26a3bd20ce08e73379b (patch)
tree70651e145fa49158174fd954b9eb1eadc1ed4fa0 /test
parent15808db4a6b985240bd655e54ecb53c04e54fdad (diff)
downloadchrome-ec-d9b9cb6e89a9d3082421e26a3bd20ce08e73379b.tar.gz
run_device_tests: Add explicit function to power cycle the board
BUG=b:180445334 BRANCH=none TEST=run_device_tests.py -b dartmonkey -t system_is_locked_wp_off TEST=run_device_tests.py -b dartmonkey -t system_is_locked_wp_on TEST=run_device_tests.py -b dartmonkey -t flash_physical TEST=run_device_tests.py -b dartmonkey -t flash_write_protect Change-Id: I4bee052e1766ff1eb09123cb494ea59d857fef18 Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4121374 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Andrea Grandi <agrandi@google.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/run_device_tests.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py
index 6e89bb2452..e22643bbee 100755
--- a/test/run_device_tests.py
+++ b/test/run_device_tests.py
@@ -503,6 +503,14 @@ def power(board_config: BoardConfig, power_on: bool) -> None:
subprocess.run(cmd, check=False).check_returncode()
+def power_cycle(board_config: BoardConfig) -> None:
+ """power_cycle the boards."""
+ logging.debug("power_cycling board")
+ power(board_config, power_on=False)
+ time.sleep(1)
+ power(board_config, power_on=True)
+
+
def hw_write_protect(enable: bool) -> None:
"""Enable/disable hardware write protect."""
if enable:
@@ -743,9 +751,7 @@ def flash_and_run_test(
return False
if test.toggle_power:
- power(board_config, power_on=False)
- time.sleep(1)
- power(board_config, power_on=True)
+ power_cycle(board_config)
hw_write_protect(test.enable_hw_write_protect)