INNER CODE UNIT · Python
_setup_device_agent
codematrixer/hmdriver2 · hmdriver2/_client.py:219
def _setup_device_agent(self, local_path: str, remote_path: str):
"""Ensure the remote agent file is correctly set up."""
if self._is_remote_file_exists(remote_path):
local_md5 = self._get_local_md5sum(local_path)
remote_md5 = self._get_remote_md5sum(remote_path)
if local_md5 == remote_md5:
logger.debug("Remote agent file is up-to-date")
self.hdc.shell(f"chmod +x {remote_path}")
return
self.hdc.shell(f"rm {remote_path}")
self.hdc.send_file(local_path, remote_path)
self.hdc.shell(f"chmod +x {remote_path}")
logger.debug("Updated remote agent file")
def _get_uitest_pid(self) -> typing.List[str]:
proc_pids = []
result = self.hdc.shell("ps -ef").output.strip()