1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

speedometer: ensure adb reverse works across reboots

Before this patch, if you used reboot_policy: "each_job", the adb reverse
connection would be lost.
This commit is contained in:
Stephen Kyle 2021-04-07 17:02:53 +01:00 committed by Marc Bonnici
parent 5558d43ddd
commit a5e5920aca

View File

@ -231,6 +231,8 @@ class Speedometer(Workload):
def run(self, context): def run(self, context):
super(Speedometer, self).run(context) super(Speedometer, self).run(context)
self.archive_server.expose_to_device(self.target)
# Generate a UUID to search for in the browser's local storage to find out # Generate a UUID to search for in the browser's local storage to find out
# when the workload has ended. # when the workload has ended.
report_end_id = uuid.uuid4().hex report_end_id = uuid.uuid4().hex
@ -245,6 +247,8 @@ class Speedometer(Workload):
self.wait_for_benchmark_to_complete(report_end_id) self.wait_for_benchmark_to_complete(report_end_id)
self.archive_server.hide_from_device(self.target)
def target_file_was_created(self, f): def target_file_was_created(self, f):
"""Assume that once self.target.file_exists(f) returns True, it will """Assume that once self.target.file_exists(f) returns True, it will
always be True from that point forward, so cache the response into the always be True from that point forward, so cache the response into the
@ -419,13 +423,15 @@ class ArchiveServer(object):
self._thread = ArchiveServerThread(self._httpd) self._thread = ArchiveServerThread(self._httpd)
self._thread.start() self._thread.start()
adb_command(target.adb_name, "reverse tcp:{0} tcp:{0}".format(self._port))
def stop(self, target): def stop(self, target):
adb_command(target.adb_name, "reverse --remove tcp:{}".format(self._port))
self._httpd.shutdown() self._httpd.shutdown()
self._thread.join() self._thread.join()
def expose_to_device(self, target):
adb_command(target.adb_name, "reverse tcp:{0} tcp:{0}".format(self._port))
def hide_from_device(self, target):
adb_command(target.adb_name, "reverse --remove tcp:{}".format(self._port))
def get_port(self): def get_port(self):
return self._port return self._port