diff options
author | Steven Koo <steven.koo@ni.com> | 2022-07-05 21:01:28 -0500 |
---|---|---|
committer | skooNI <60897865+skooNI@users.noreply.github.com> | 2022-07-20 15:57:20 -0500 |
commit | 058e4a59de0fbaf528b2f12bdb34448543b2c4c8 (patch) | |
tree | 95c277f57e1049669d17c44b1c395af6f97d7784 /.ci/utils | |
parent | 917fe5e7d753c616ffe8f342d3704481f5963b30 (diff) | |
download | uhd-058e4a59de0fbaf528b2f12bdb34448543b2c4c8.tar.gz uhd-058e4a59de0fbaf528b2f12bdb34448543b2c4c8.tar.bz2 uhd-058e4a59de0fbaf528b2f12bdb34448543b2c4c8.zip |
ci: call powerbtn multiple times to power on
Signed-off-by: Steven Koo <steven.koo@ni.com>
Diffstat (limited to '.ci/utils')
-rw-r--r-- | .ci/utils/mutex_hardware.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/.ci/utils/mutex_hardware.py b/.ci/utils/mutex_hardware.py index e9c102469..485f0fcbd 100644 --- a/.ci/utils/mutex_hardware.py +++ b/.ci/utils/mutex_hardware.py @@ -56,9 +56,11 @@ def flash_sdimage(dev_model, sdimage_path, labgrid_device_yaml, mgmt_addr, sfp_a env = labgrid.Environment(labgrid_device_yaml) target = env.get_target() + cp_scu = target.get_driver(labgrid.protocol.ConsoleProtocol, name="scu_serial_driver") + cp_linux = target.get_driver(labgrid.protocol.ConsoleProtocol, name="linux_serial_driver") + print("Powering down DUT", flush=True) - cp = target.get_driver(labgrid.protocol.ConsoleProtocol, name="scu_serial_driver") - cp.write("\napshutdown\n".encode()) + cp_scu.write("\napshutdown\n".encode()) print("Switching SDMux to Host", flush=True) sdmux = target.get_driver(labgrid.driver.USBSDMuxDriver) @@ -78,10 +80,19 @@ def flash_sdimage(dev_model, sdimage_path, labgrid_device_yaml, mgmt_addr, sfp_a time.sleep(30) print("Powering on DUT", flush=True) - cp.write("\npowerbtn\n".encode()) + cp_scu.write("\npowerbtn\n".encode()) + + try: + cp_linux.expect("Enter 'noautoboot' to enter prompt without timeout", timeout=5) + except Exception: + # Sometimes it requires multiple powerbtn calls to turn on device + print("Device didn't power on with first attempt. Trying again...") + cp_scu.write("\npowerbtn\n".encode()) + cp_linux.expect("Enter 'noautoboot' to enter prompt without timeout", timeout=5) print("Waiting 2 minutes for device to boot", flush=True) time.sleep(120) + cp_linux.expect("login:", timeout=5) known_hosts_path = os.path.expanduser("~/.ssh/known_hosts") subprocess.run(shlex.split(f"ssh-keygen -f \"{known_hosts_path}\" -R \"{mgmt_addr}\"")) |