mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-07 05:31:21 +00:00
framework/workload: Add check for platform
Remove unused ``platform`` attributes and add ``supported_platforms`` along with check so that workloads can fail early when attempting to run on an incorrect platform.
This commit is contained in:
parent
60b37995e0
commit
1648a58c11
@ -73,6 +73,12 @@ class Workload(TargetedPlugin):
|
|||||||
self.asset_files = []
|
self.asset_files = []
|
||||||
self.deployed_assets = []
|
self.deployed_assets = []
|
||||||
|
|
||||||
|
supported_platforms = getattr(self, 'supported_platforms', [])
|
||||||
|
if supported_platforms and self.target.os not in supported_platforms:
|
||||||
|
msg = 'Supported platforms for "{}" are "{}", attemping to run on "{}"'
|
||||||
|
raise WorkloadError(msg.format(self.name, ' '.join(self.supported_platforms),
|
||||||
|
self.target.os))
|
||||||
|
|
||||||
def init_resources(self, resolver):
|
def init_resources(self, resolver):
|
||||||
"""
|
"""
|
||||||
This method may be used to perform early resource discovery and
|
This method may be used to perform early resource discovery and
|
||||||
@ -165,6 +171,8 @@ class Workload(TargetedPlugin):
|
|||||||
|
|
||||||
class ApkWorkload(Workload):
|
class ApkWorkload(Workload):
|
||||||
|
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
# May be optionally overwritten by subclasses
|
# May be optionally overwritten by subclasses
|
||||||
# Times are in seconds
|
# Times are in seconds
|
||||||
loading_time = 10
|
loading_time = 10
|
||||||
@ -326,8 +334,6 @@ class ApkUIWorkload(ApkWorkload):
|
|||||||
|
|
||||||
class ApkUiautoWorkload(ApkUIWorkload):
|
class ApkUiautoWorkload(ApkUIWorkload):
|
||||||
|
|
||||||
platform = 'android'
|
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('markers_enabled', kind=bool, default=False,
|
Parameter('markers_enabled', kind=bool, default=False,
|
||||||
description="""
|
description="""
|
||||||
@ -407,7 +413,7 @@ class UIWorkload(Workload):
|
|||||||
|
|
||||||
class UiautoWorkload(UIWorkload):
|
class UiautoWorkload(UIWorkload):
|
||||||
|
|
||||||
platform = 'android'
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('markers_enabled', kind=bool, default=False,
|
Parameter('markers_enabled', kind=bool, default=False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user