Esempio n. 1
0
    def execute(self, hardware):
        hardware.sanity_check()
        self._schedule_hardware_poll()

        commandline = self.ARGV + [
            '--config', self.config, '--skp', self.skp, '--suppressHeader',
            'true'
        ]
        if FLAGS.write_path:
            pngfile = _path.join(FLAGS.write_path, self.config,
                                 _path.basename(self.skp) + '.png')
            commandline.extend(['--png', pngfile])
        if (FLAGS.verbosity >= 4):
            quoted = [
                '\'%s\'' % re.sub(r'([\\\'])', r'\\\1', x) for x in commandline
            ]
            print(' '.join(quoted), file=sys.stderr)
        self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE)
        self._monitor = SubprocessMonitor(self._queue, self._proc)
        self._monitor.start()

        while True:
            message = self._queue.get()
            if message.message == Message.READLINE:
                result = BenchResult.match(message.value)
                if result:
                    hardware.sanity_check()
                    self._process_result(result)
                else:
                    print(message.value)
                sys.stdout.flush()
                continue
            if message.message == Message.POLL_HARDWARE:
                hardware.sanity_check()
                self._schedule_hardware_poll()
                continue
            if message.message == Message.EXIT:
                self._monitor.join()
                self._proc.wait()
                if self._proc.returncode != 0:
                    raise Exception(
                        "skpbench exited with nonzero exit code %i" %
                        self._proc.returncode)
                self._proc = None
                break
Esempio n. 2
0
    def execute(self, hardware):
        hardware.sanity_check()
        self._schedule_hardware_poll()

        commandline = self.ARGV + [
            '--config', self.config, '--src', self.src, '--suppressHeader',
            'true'
        ]
        if FLAGS.write_path:
            pngfile = _path.join(FLAGS.write_path, self.config,
                                 _path.basename(self.src) + '.png')
            commandline.extend(['--png', pngfile])
        dump_commandline_if_verbose(commandline)
        self._proc = subprocess.Popen(commandline,
                                      stdout=subprocess.PIPE,
                                      stderr=subprocess.STDOUT)
        self._monitor = SubprocessMonitor(self._queue, self._proc)
        self._monitor.start()

        while True:
            message = self._queue.get()
            if message.message == Message.READLINE:
                result = BenchResult.match(message.value)
                if result:
                    hardware.sanity_check()
                    self._process_result(result)
                elif hardware.filter_line(message.value):
                    print(message.value, file=sys.stderr)
                continue
            if message.message == Message.POLL_HARDWARE:
                hardware.sanity_check()
                self._schedule_hardware_poll()
                continue
            if message.message == Message.EXIT:
                self._monitor.join()
                self._proc.wait()
                if self._proc.returncode != 0:
                    raise Exception(
                        "skpbench exited with nonzero exit code %i" %
                        self._proc.returncode)
                self._proc = None
                break
Esempio n. 3
0
  def run(self):
    """Called on the background thread.

    Launches and reads output from an skpbench process.

    """
    commandline = self.ARGV + ['--config', self.config,
                               '--skp', self.skp,
                               '--suppressHeader', 'true']
    if (FLAGS.write_path):
      pngfile = _path.join(FLAGS.write_path, self.config,
                           _path.basename(self.skp) + '.png')
      commandline.extend(['--png', pngfile])
    if (FLAGS.verbosity >= 3):
      print(' '.join(commandline), file=sys.stderr)
    proc = subprocess.Popen(commandline, stdout=subprocess.PIPE)
    for line in iter(proc.stdout.readline, b''):
      self._queue.put(Message(Message.READLINE, line.decode('utf-8').rstrip()))
    proc.wait()
    self._queue.put(Message(Message.EXIT, proc.returncode))
Esempio n. 4
0
  def execute(self, hardware):
    hardware.sanity_check()
    self._schedule_hardware_poll()

    commandline = self.ARGV + ['--config', self.config,
                               '--skp', self.skp,
                               '--suppressHeader', 'true']
    if FLAGS.write_path:
      pngfile = _path.join(FLAGS.write_path, self.config,
                           _path.basename(self.skp) + '.png')
      commandline.extend(['--png', pngfile])
    dump_commandline_if_verbose(commandline)
    self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE)
    self._monitor = SubprocessMonitor(self._queue, self._proc)
    self._monitor.start()

    while True:
      message = self._queue.get()
      if message.message == Message.READLINE:
        result = BenchResult.match(message.value)
        if result:
          hardware.sanity_check()
          self._process_result(result)
        else:
          print(message.value, file=sys.stderr)
        sys.stdout.flush()
        continue
      if message.message == Message.POLL_HARDWARE:
        hardware.sanity_check()
        self._schedule_hardware_poll()
        continue
      if message.message == Message.EXIT:
        self._monitor.join()
        self._proc.wait()
        if self._proc.returncode != 0:
          raise Exception("skpbench exited with nonzero exit code %i" %
                          self._proc.returncode)
        self._proc = None
        break