1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-14 14:48:53 +00:00

Move file management logic to per worload run

Move file management steps to initialize and finalize methods instead of
setup and teardown. These steps should be performed per run instead of
per iteration. Affected workloads: gmail, googlephotos.
This commit is contained in:
John Richardson 2016-05-12 12:59:58 +01:00
parent 2579c01757
commit 118112a9fc
4 changed files with 21 additions and 12 deletions

View File

@ -42,8 +42,16 @@ class Gmail(AndroidUiAutoBenchmark):
super(Gmail, self).__init__(device, **kwargs)
self.uiauto_params['recipient'] = self.recipient
def setup(self, context):
super(Gmail, self).setup(context)
def validate(self):
super(Gmail, self).validate()
self.output_file = os.path.join(self.device.working_directory, self.instrumentation_log)
self.uiauto_params['package'] = self.package
self.uiauto_params['output_dir'] = self.device.working_directory
self.uiauto_params['output_file'] = self.output_file
self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled
def initialize(self, context):
super(Gmail, self).initialize(context)
self.storage_dir = self.device.path.join(self.device.working_directory)
@ -55,14 +63,6 @@ class Gmail(AndroidUiAutoBenchmark):
# Force a re-index of the mediaserver cache to pick up new files
self.device.execute('am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard')
def validate(self):
super(Gmail, self).validate()
self.output_file = os.path.join(self.device.working_directory, self.instrumentation_log)
self.uiauto_params['package'] = self.package
self.uiauto_params['output_dir'] = self.device.working_directory
self.uiauto_params['output_file'] = self.output_file
self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled
def update_result(self, context):
super(Gmail, self).update_result(context)
@ -88,6 +88,11 @@ class Gmail(AndroidUiAutoBenchmark):
if file.endswith(".log"):
self.device.pull_file(os.path.join(self.device.working_directory, file), context.output_directory)
self.device.delete_file(os.path.join(self.device.working_directory, file))
def finalize(self, context):
super(Gmail, self).finalize(context)
for file in self.device.listdir(self.device.working_directory):
if file.endswith(".jpg"):
self.device.delete_file(os.path.join(self.device.working_directory, file))

View File

@ -58,8 +58,8 @@ class Googlephotos(AndroidUiAutoBenchmark):
self.uiauto_params['output_file'] = self.output_file
self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled
def setup(self, context):
super(Googlephotos, self).setup(context)
def initialize(self, context):
super(Googlephotos, self).initialize(context)
for entry in os.listdir(self.dependencies_directory):
wa_file = ''.join([self.file_prefix, entry])
@ -96,6 +96,10 @@ class Googlephotos(AndroidUiAutoBenchmark):
context.output_directory)
self.device.delete_file(os.path.join(self.device.working_directory, entry))
def finalize(self, context):
super(Googlephotos, self).finalize(context)
for entry in self.device.listdir(self.device.working_directory):
if entry.startswith(self.file_prefix) and entry.endswith(".jpg"):
self.device.delete_file(os.path.join(self.device.working_directory, entry))