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

Merge pull request #19 from jimboatarm/move_to_init

Move file management logic to per worload run
This commit is contained in:
jimboatarm 2016-05-12 20:07:11 +01:00
commit 61a92bc036
4 changed files with 21 additions and 12 deletions

View File

@ -42,8 +42,16 @@ class Gmail(AndroidUiAutoBenchmark):
super(Gmail, self).__init__(device, **kwargs) super(Gmail, self).__init__(device, **kwargs)
self.uiauto_params['recipient'] = self.recipient self.uiauto_params['recipient'] = self.recipient
def setup(self, context): def validate(self):
super(Gmail, self).setup(context) 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) 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 # 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') 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): def update_result(self, context):
super(Gmail, self).update_result(context) super(Gmail, self).update_result(context)
@ -88,6 +88,11 @@ class Gmail(AndroidUiAutoBenchmark):
if file.endswith(".log"): if file.endswith(".log"):
self.device.pull_file(os.path.join(self.device.working_directory, file), context.output_directory) 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)) 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"): if file.endswith(".jpg"):
self.device.delete_file(os.path.join(self.device.working_directory, file)) 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['output_file'] = self.output_file
self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled
def setup(self, context): def initialize(self, context):
super(Googlephotos, self).setup(context) super(Googlephotos, self).initialize(context)
for entry in os.listdir(self.dependencies_directory): for entry in os.listdir(self.dependencies_directory):
wa_file = ''.join([self.file_prefix, entry]) wa_file = ''.join([self.file_prefix, entry])
@ -96,6 +96,10 @@ class Googlephotos(AndroidUiAutoBenchmark):
context.output_directory) context.output_directory)
self.device.delete_file(os.path.join(self.device.working_directory, entry)) 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"): if entry.startswith(self.file_prefix) and entry.endswith(".jpg"):
self.device.delete_file(os.path.join(self.device.working_directory, entry)) self.device.delete_file(os.path.join(self.device.working_directory, entry))