mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 20:11:20 +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))),
|
||||
choices=extension_types)
|
||||
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):
|
||||
filters = {}
|
||||
@ -39,7 +41,7 @@ class ListCommand(Command):
|
||||
|
||||
ext_loader = ExtensionLoader(packages=settings.extension_packages, paths=settings.extension_paths)
|
||||
results = ext_loader.list_extensions(args.kind[:-1])
|
||||
if filters:
|
||||
if filters or args.platform:
|
||||
filtered_results = []
|
||||
for result in results:
|
||||
passed = True
|
||||
@ -47,6 +49,8 @@ class ListCommand(Command):
|
||||
if getattr(result, k) != v:
|
||||
passed = False
|
||||
break
|
||||
if passed and args.platform:
|
||||
passed = check_platform(result, args.platform)
|
||||
if passed:
|
||||
filtered_results.append(result)
|
||||
else: # no filters specified
|
||||
@ -57,3 +61,10 @@ class ListCommand(Command):
|
||||
for result in sorted(filtered_results, key=lambda x: x.name):
|
||||
output.add_item(get_summary(result), result.name)
|
||||
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
|
||||
install_timeout = None
|
||||
default_install_timeout = 300
|
||||
supported_platforms = ['android']
|
||||
|
||||
parameters = [
|
||||
Parameter('uninstall_apk', kind=boolean, default=False,
|
||||
@ -304,6 +305,8 @@ class ReventWorkload(Workload):
|
||||
|
||||
class AndroidUiAutoBenchmark(UiAutomatorWorkload, AndroidBenchmark):
|
||||
|
||||
supported_platforms = ['android']
|
||||
|
||||
def __init__(self, device, **kwargs):
|
||||
UiAutomatorWorkload.__init__(self, device, **kwargs)
|
||||
AndroidBenchmark.__init__(self, device, _call_super=False, **kwargs)
|
||||
@ -357,6 +360,7 @@ class GameWorkload(ApkWorkload, ReventWorkload):
|
||||
view = 'SurfaceView'
|
||||
install_timeout = 500
|
||||
loading_time = 10
|
||||
supported_platforms = ['android']
|
||||
|
||||
def __init__(self, device, **kwargs): # pylint: disable=W0613
|
||||
ApkWorkload.__init__(self, device, **kwargs)
|
||||
|
@ -70,6 +70,7 @@ class FpsInstrument(Instrument):
|
||||
vsync cycle.
|
||||
|
||||
"""
|
||||
supported_platforms = ['android']
|
||||
|
||||
parameters = [
|
||||
Parameter('drop_threshold', kind=numeric, default=5,
|
||||
|
@ -60,6 +60,7 @@ class ApplaunchWorkload(Workload):
|
||||
Measures the time and energy used in launching an application.
|
||||
|
||||
"""
|
||||
supported_platforms = ['android']
|
||||
|
||||
parameters = [
|
||||
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.
|
||||
|
||||
"""
|
||||
supported_platforms = ['android']
|
||||
|
||||
parameters = [
|
||||
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'
|
||||
run_timeout = 5 * 60
|
||||
|
||||
|
@ -28,6 +28,7 @@ class HomeScreen(Workload):
|
||||
specified duration.
|
||||
|
||||
"""
|
||||
supported_platforms = ['android']
|
||||
|
||||
parameters = [
|
||||
Parameter('duration', kind=int, default=20,
|
||||
|
@ -42,6 +42,7 @@ class PowerLoadtest(Workload):
|
||||
See: https://www.chromium.org/chromium-os/testing/power-testing
|
||||
|
||||
'''
|
||||
supported_platforms = ['chromeos']
|
||||
|
||||
parameters = [
|
||||
Parameter('board', default=os.getenv('BOARD'),
|
||||
|
@ -45,6 +45,7 @@ class VideoWorkload(Workload):
|
||||
.. _Big Buck Bunny: http://www.bigbuckbunny.org/
|
||||
|
||||
"""
|
||||
supported_platforms = ['android']
|
||||
|
||||
parameters = [
|
||||
Parameter('play_duration', kind=int, default=20,
|
||||
|
Loading…
x
Reference in New Issue
Block a user