コード例 #1
0
 def validate(self):
     if self.duration is None:
         if self.user_triggered is None:
             self.user_triggered = True
         elif self.user_triggered is False:
             self.duration = self.default_duration
     if self.user_triggered and self.duration:
         message = 'Manual Workload can either specify duration or be user triggered, but not both'
         raise ConfigError(message)
     if not self.user_triggered and not self.duration:
         raise ConfigError('Either user_triggered must be ``True`` or duration must be > 0.')
コード例 #2
0
 def validate(self):
     if self.report_option_string and (self.command != "record"):
         raise ConfigError(
             "report_option_string only works with perf/simpleperf record. Set command to record or remove report_option_string"
         )
     if self.report_sample_options and (self.command != "record"):
         raise ConfigError(
             "report_sample_options only works with perf/simpleperf record. Set command to record or remove report_sample_options"
         )
     if self.run_report_sample and (self.command != "record"):
         raise ConfigError(
             "run_report_sample only works with perf/simpleperf record. Set command to record or remove run_report_sample"
         )
コード例 #3
0
    def run(self, context):
        self.target.execute(self.play_cmd)

        self.monitor.wait_for(REGEXPS['start'])
        self.logger.info('Playing media file')

        line = self.monitor.wait_for(REGEXPS['duration'])[0]
        media_duration_s = int(
            round(float(
                re.search(REGEXPS['duration'], line).group('duration'))))

        self.logger.info(
            'Media duration is {} seconds'.format(media_duration_s))

        if self.duration > media_duration_s:
            raise ConfigError(
                "'duration' param ({}) longer than media duration ({})".format(
                    self.duration, media_duration_s))

        if self.duration:
            self.logger.info(
                'Waiting {} seconds before ending playback'.format(
                    self.duration))
            time.sleep(self.duration)
        else:
            self.logger.info(
                'Waiting for playback completion ({} seconds)'.format(
                    media_duration_s))
            self.monitor.wait_for(REGEXPS['end'],
                                  timeout=media_duration_s + 30)
コード例 #4
0
    def validate(self):
        if self.format and self.filename:
            raise ConfigError(
                'Either format *or* filename must be specified; but not both.')

        if not self.format and not self.filename:
            self.format = self.default_format
コード例 #5
0
ファイル: __init__.py プロジェクト: Binse-Park/lisa-1
 def validate(self):
     if self.mloops and self.duration:  # pylint: disable=E0203
         msg = 'mloops and duration cannot be both specified at the '\
               'same time for dhrystone.'
         raise ConfigError(msg)
     if not self.mloops and not self.duration:  # pylint: disable=E0203
         self.mloops = self.default_mloops
コード例 #6
0
 def initialize(self, context):
     self.old_screen_state = None
     if self.target.os == 'android':
         if self.stop_android and not self.target.is_rooted:
             msg = 'Idle workload requires the device to be rooted in order to stop Android.'
             raise WorkloadError(msg)
     else:
         if self.stop_android or self.screen_off:
             msg = 'stop_android/screen_off can only be set for Android devices'
             raise ConfigError(msg)
コード例 #7
0
 def validate(self):
     if (self.max_requests is None) and (self.max_time is None):
         self.max_time = 30
     if self.max_time and (self.max_time + 10) > self.timeout:
         self.timeout = self.max_time + 10
     if self.test == 'fileio' and not self.file_test_mode:
         self.logger.debug('Test is "fileio" and no file_test_mode specified -- using default.')
         self.file_test_mode = 'seqwr'
     elif self.test != 'fileio' and self.file_test_mode:
         raise ConfigError('file_test_mode must not be specified unless test is "fileio"')
コード例 #8
0
 def run(self, context):
     self.logger.info('START NOW!')
     if self.duration:
         self.target.sleep(self.duration)
     elif self.user_triggered:
         self.logger.info('')
         self.logger.info('hit any key to end your workload execution...')
         getch()
     else:
         raise ConfigError('Illegal parameters for manual workload')
     self.logger.info('DONE!')
コード例 #9
0
    def setup(self, context):
        super(Jankbench, self).setup(context)

        if self.pull_results_db is None:
            self.pull_results_db = self.target.is_rooted
        elif self.pull_results_db and not self.target.is_rooted:
            raise ConfigError('pull_results_db set for an unrooted device')

        if not self.target.is_container:
            self.target.ensure_screen_is_on()

        self.command = self._build_command()
        self.monitor = JankbenchRunMonitor(self.target)
        self.monitor.start()
コード例 #10
0
 def validate(self):
     if len(self.run_phases) != len(self.per_phase_cpu_ids):
         msg = "Number of phases doesn't match the number of CPU mappings"
         raise ConfigError(msg)
コード例 #11
0
 def validate(self):
     if self.stressor == 'vm' and self.duration < 60:
         raise ConfigError('vm test duration needs to be >= 60s.')
コード例 #12
0
 def validate(self):
     if not self.read and not self.write:
         raise ConfigError('Either "read" or "write" must be True.')
     if not self.mmf and self.sync_delay:
         raise ConfigError('sync_delay can only be set if mmf is True')