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

speedometer: fix @once methods which declare attributes

We need to make those attributes class-attributes, to make sure they are still
defined in subsequent jobs. We still access them through 'self', however.
This commit is contained in:
Stephen Kyle 2021-04-07 17:09:51 +01:00 committed by Marc Bonnici
parent a5e5920aca
commit f08770884a

View File

@ -128,7 +128,7 @@ class Speedometer(Workload):
@once
def initialize(self, context):
super(Speedometer, self).initialize(context)
self.archive_server = ArchiveServer()
Speedometer.archive_server = ArchiveServer()
if not self.target.is_rooted:
raise WorkloadError(
"Device must be rooted for the speedometer workload currently"
@ -148,18 +148,17 @@ class Speedometer(Workload):
# Temporary directory used for storing the Speedometer files, uiautomator
# dumps, and modified XML chrome config files.
self.temp_dir = tempfile.TemporaryDirectory()
self.document_root = os.path.join(self.temp_dir.name, "document_root")
Speedometer.temp_dir = tempfile.TemporaryDirectory()
Speedometer.document_root = os.path.join(self.temp_dir.name, "document_root")
# Host a copy of Speedometer locally
tarball = context.get_resource(File(self, "speedometer_archive.tgz"))
with tarfile.open(name=tarball) as handle:
handle.extractall(self.temp_dir.name)
self.archive_server.start(self.document_root, self.target)
self.webserver_port = self.archive_server.get_port()
self.speedometer_url = "http://localhost:{}/Speedometer2.0/index.html".format(
self.webserver_port
Speedometer.speedometer_url = "http://localhost:{}/Speedometer2.0/index.html".format(
self.archive_server.get_port()
)
def setup(self, context):