1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

revent: Timeout is now based on recording duration

The revent file is now parsed and the duration of the recording is calculated.
This duration + 30 seconds is now used for the timeout for revent.
This commit is contained in:
Sebastian Goscik
2016-07-19 10:24:01 +01:00
parent cb01b0c9a9
commit 164f207084
2 changed files with 12 additions and 6 deletions

View File

@@ -16,6 +16,7 @@
import os import os
import sys import sys
import signal import signal
from math import ceil
from wlauto import ExtensionLoader, Command, settings from wlauto import ExtensionLoader, Command, settings
from wlauto.common.resources import Executable from wlauto.common.resources import Executable
@@ -23,6 +24,7 @@ from wlauto.core.resource import NO_ONE
from wlauto.core.resolver import ResourceResolver from wlauto.core.resolver import ResourceResolver
from wlauto.core.configuration import RunConfiguration from wlauto.core.configuration import RunConfiguration
from wlauto.core.agenda import Agenda from wlauto.core.agenda import Agenda
from wlauto.utils.revent import ReventParser
class RecordCommand(Command): class RecordCommand(Command):
@@ -159,7 +161,8 @@ class ReplayCommand(RecordCommand):
self.logger.info("Replaying recording") self.logger.info("Replaying recording")
command = "{} replay {}".format(self.target_binary, revent_file) command = "{} replay {}".format(self.target_binary, revent_file)
self.device.execute(command) timeout = ceil(ReventParser.get_revent_duration(args.revent)) + 30
self.device.execute(command, timeout=timeout)
self.logger.info("Finished replay") self.logger.info("Finished replay")

View File

@@ -16,6 +16,7 @@
import os import os
import sys import sys
import time import time
from math import ceil
from wlauto.core.extension import Parameter from wlauto.core.extension import Parameter
from wlauto.core.workload import Workload from wlauto.core.workload import Workload
@@ -25,6 +26,7 @@ from wlauto.common.resources import ExtensionAsset, Executable
from wlauto.exceptions import WorkloadError, ResourceError, ConfigError from wlauto.exceptions import WorkloadError, ResourceError, ConfigError
from wlauto.utils.android import ApkInfo, ANDROID_NORMAL_PERMISSIONS from wlauto.utils.android import ApkInfo, ANDROID_NORMAL_PERMISSIONS
from wlauto.utils.types import boolean from wlauto.utils.types import boolean
from wlauto.utils.revent import ReventParser
import wlauto.common.android.resources import wlauto.common.android.resources
@@ -322,16 +324,13 @@ AndroidBenchmark = ApkWorkload # backward compatibility
class ReventWorkload(Workload): class ReventWorkload(Workload):
default_setup_timeout = 5 * 60 # in seconds
default_run_timeout = 10 * 60 # in seconds
def __init__(self, device, _call_super=True, **kwargs): def __init__(self, device, _call_super=True, **kwargs):
if _call_super: if _call_super:
super(ReventWorkload, self).__init__(device, **kwargs) super(ReventWorkload, self).__init__(device, **kwargs)
devpath = self.device.path devpath = self.device.path
self.on_device_revent_binary = devpath.join(self.device.binaries_directory, 'revent') self.on_device_revent_binary = devpath.join(self.device.binaries_directory, 'revent')
self.setup_timeout = kwargs.get('setup_timeout', self.default_setup_timeout) self.setup_timeout = kwargs.get('setup_timeout', None)
self.run_timeout = kwargs.get('run_timeout', self.default_run_timeout) self.run_timeout = kwargs.get('run_timeout', None)
self.revent_setup_file = None self.revent_setup_file = None
self.revent_run_file = None self.revent_run_file = None
self.on_device_setup_revent = None self.on_device_setup_revent = None
@@ -346,6 +345,10 @@ class ReventWorkload(Workload):
self.on_device_run_revent = devpath.join(self.device.working_directory, self.on_device_run_revent = devpath.join(self.device.working_directory,
os.path.split(self.revent_run_file)[-1]) os.path.split(self.revent_run_file)[-1])
self._check_revent_files(context) self._check_revent_files(context)
default_setup_timeout = ceil(ReventParser.get_revent_duration(self.revent_setup_file)) + 30
default_run_timeout = ceil(ReventParser.get_revent_duration(self.revent_run_file)) + 30
self.setup_timeout = self.setup_timeout or default_setup_timeout
self.run_timeout = self.run_timeout or default_run_timeout
def setup(self, context): def setup(self, context):
self.device.killall('revent') self.device.killall('revent')