mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 04:21:17 +00:00
list command: can now filter results by supported platform
Added -p option to the list command. This alows filtering results by supported platforms, e.g. wa list workloads -p linux Also adding missing supported_platforms attribute to various extensions. If an extension does not have this attribute, the assumption is that it is supported by all available platforms.
This commit is contained in:
parent
53de517488
commit
e7fae25821
@ -31,6 +31,8 @@ class ListCommand(Command):
|
|||||||
'one of: {}'.format(', '.join(extension_types))),
|
'one of: {}'.format(', '.join(extension_types))),
|
||||||
choices=extension_types)
|
choices=extension_types)
|
||||||
self.parser.add_argument('-n', '--name', help='Filter results by the name specified')
|
self.parser.add_argument('-n', '--name', help='Filter results by the name specified')
|
||||||
|
self.parser.add_argument('-p', '--platform', help='Only list results that are supported by '
|
||||||
|
'the specified platform')
|
||||||
|
|
||||||
def execute(self, args):
|
def execute(self, args):
|
||||||
filters = {}
|
filters = {}
|
||||||
@ -39,7 +41,7 @@ class ListCommand(Command):
|
|||||||
|
|
||||||
ext_loader = ExtensionLoader(packages=settings.extension_packages, paths=settings.extension_paths)
|
ext_loader = ExtensionLoader(packages=settings.extension_packages, paths=settings.extension_paths)
|
||||||
results = ext_loader.list_extensions(args.kind[:-1])
|
results = ext_loader.list_extensions(args.kind[:-1])
|
||||||
if filters:
|
if filters or args.platform:
|
||||||
filtered_results = []
|
filtered_results = []
|
||||||
for result in results:
|
for result in results:
|
||||||
passed = True
|
passed = True
|
||||||
@ -47,6 +49,8 @@ class ListCommand(Command):
|
|||||||
if getattr(result, k) != v:
|
if getattr(result, k) != v:
|
||||||
passed = False
|
passed = False
|
||||||
break
|
break
|
||||||
|
if passed and args.platform:
|
||||||
|
passed = check_platform(result, args.platform)
|
||||||
if passed:
|
if passed:
|
||||||
filtered_results.append(result)
|
filtered_results.append(result)
|
||||||
else: # no filters specified
|
else: # no filters specified
|
||||||
@ -57,3 +61,10 @@ class ListCommand(Command):
|
|||||||
for result in sorted(filtered_results, key=lambda x: x.name):
|
for result in sorted(filtered_results, key=lambda x: x.name):
|
||||||
output.add_item(get_summary(result), result.name)
|
output.add_item(get_summary(result), result.name)
|
||||||
print output.format_data()
|
print output.format_data()
|
||||||
|
|
||||||
|
|
||||||
|
def check_platform(extension, platform):
|
||||||
|
supported_platforms = getattr(extension, 'supported_platforms', [])
|
||||||
|
if supported_platforms:
|
||||||
|
return platform in supported_platforms
|
||||||
|
return True
|
||||||
|
@ -144,6 +144,7 @@ class ApkWorkload(Workload):
|
|||||||
view = None
|
view = None
|
||||||
install_timeout = None
|
install_timeout = None
|
||||||
default_install_timeout = 300
|
default_install_timeout = 300
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('uninstall_apk', kind=boolean, default=False,
|
Parameter('uninstall_apk', kind=boolean, default=False,
|
||||||
@ -304,6 +305,8 @@ class ReventWorkload(Workload):
|
|||||||
|
|
||||||
class AndroidUiAutoBenchmark(UiAutomatorWorkload, AndroidBenchmark):
|
class AndroidUiAutoBenchmark(UiAutomatorWorkload, AndroidBenchmark):
|
||||||
|
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
def __init__(self, device, **kwargs):
|
def __init__(self, device, **kwargs):
|
||||||
UiAutomatorWorkload.__init__(self, device, **kwargs)
|
UiAutomatorWorkload.__init__(self, device, **kwargs)
|
||||||
AndroidBenchmark.__init__(self, device, _call_super=False, **kwargs)
|
AndroidBenchmark.__init__(self, device, _call_super=False, **kwargs)
|
||||||
@ -357,6 +360,7 @@ class GameWorkload(ApkWorkload, ReventWorkload):
|
|||||||
view = 'SurfaceView'
|
view = 'SurfaceView'
|
||||||
install_timeout = 500
|
install_timeout = 500
|
||||||
loading_time = 10
|
loading_time = 10
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
def __init__(self, device, **kwargs): # pylint: disable=W0613
|
def __init__(self, device, **kwargs): # pylint: disable=W0613
|
||||||
ApkWorkload.__init__(self, device, **kwargs)
|
ApkWorkload.__init__(self, device, **kwargs)
|
||||||
|
@ -70,6 +70,7 @@ class FpsInstrument(Instrument):
|
|||||||
vsync cycle.
|
vsync cycle.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('drop_threshold', kind=numeric, default=5,
|
Parameter('drop_threshold', kind=numeric, default=5,
|
||||||
|
@ -60,6 +60,7 @@ class ApplaunchWorkload(Workload):
|
|||||||
Measures the time and energy used in launching an application.
|
Measures the time and energy used in launching an application.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('app', default='browser', allowed_values=['calculator', 'browser', 'calendar'],
|
Parameter('app', default='browser', allowed_values=['calculator', 'browser', 'calendar'],
|
||||||
|
@ -33,6 +33,7 @@ class Audio(Workload):
|
|||||||
it plays Canon_in_D_Pieano.mp3 for 30 seconds.
|
it plays Canon_in_D_Pieano.mp3 for 30 seconds.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('duration', kind=int, default=30,
|
Parameter('duration', kind=int, default=30,
|
||||||
|
@ -39,6 +39,7 @@ class Dex2oatBenchmark(Workload):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
supported_platforms = ['android']
|
||||||
command_template = 'dex2oat --dex-file={} --oat-file={} --instruction-set={} --dump-timing'
|
command_template = 'dex2oat --dex-file={} --oat-file={} --instruction-set={} --dump-timing'
|
||||||
run_timeout = 5 * 60
|
run_timeout = 5 * 60
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class HomeScreen(Workload):
|
|||||||
specified duration.
|
specified duration.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('duration', kind=int, default=20,
|
Parameter('duration', kind=int, default=20,
|
||||||
|
@ -42,6 +42,7 @@ class PowerLoadtest(Workload):
|
|||||||
See: https://www.chromium.org/chromium-os/testing/power-testing
|
See: https://www.chromium.org/chromium-os/testing/power-testing
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
supported_platforms = ['chromeos']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('board', default=os.getenv('BOARD'),
|
Parameter('board', default=os.getenv('BOARD'),
|
||||||
|
@ -45,6 +45,7 @@ class VideoWorkload(Workload):
|
|||||||
.. _Big Buck Bunny: http://www.bigbuckbunny.org/
|
.. _Big Buck Bunny: http://www.bigbuckbunny.org/
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
supported_platforms = ['android']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('play_duration', kind=int, default=20,
|
Parameter('play_duration', kind=int, default=20,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user