Beispiel #1
0
  def test_construct_adb_shell_command(self):
    command = util.construct_adb_shell_command(LIST_TMP_ARGS, None)
    self.assertEqual(' '.join(command), 'adb shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(LIST_TMP_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(ATRACE_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell atrace -z -t 10 -b 4096')
Beispiel #2
0
  def test_construct_adb_shell_command(self):
    command = util.construct_adb_shell_command(LIST_TMP_ARGS, None)
    self.assertEqual(' '.join(command), 'adb shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(LIST_TMP_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(ATRACE_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell atrace -z -t 10 -b 4096')
Beispiel #3
0
 def _construct_setup_command(self):
   echo_args = ['echo'] + self._categories + ['>', BOOTTRACE_CATEGORIES]
   setprop_args = ['setprop', BOOTTRACE_PROP, '1']
   reboot_args = ['reboot']
   return util.construct_adb_shell_command(
       echo_args + ['&&'] + setprop_args + ['&&'] + reboot_args,
       self._options.device_serial)
Beispiel #4
0
 def _construct_trace_command(self):
   self._expect_trace = True
   atrace_args = ['atrace', '--async_stop']
   setprop_args = ['setprop', BOOTTRACE_PROP, '0']
   rm_args = ['rm', BOOTTRACE_CATEGORIES]
   return util.construct_adb_shell_command(
         atrace_args + ['&&'] + setprop_args + ['&&'] + rm_args,
         self._options.device_serial)
Beispiel #5
0
  def _construct_trace_command(self):
    """Builds a command-line used to invoke a trace process.

    Returns:
      A tuple where the first element is an array of command-line arguments, and
      the second element is a boolean which will be true if the commend will
      stream trace data.
    """
    if self._options.list_categories:
      tracer_args = self._construct_list_categories_command()
      self._expect_trace = False
    elif self._options.from_file is not None:
      tracer_args = ['cat', self._options.from_file]
      self._expect_trace = True
    else:
      atrace_args = ATRACE_BASE_ARGS[:]
      self._expect_trace = True
      if self._options.compress_trace_data:
        atrace_args.extend(['-z'])

      if ((self._options.trace_time is not None)
          and (self._options.trace_time > 0)):
        atrace_args.extend(['-t', str(self._options.trace_time)])

      if ((self._options.trace_buf_size is not None)
          and (self._options.trace_buf_size > 0)):
        atrace_args.extend(['-b', str(self._options.trace_buf_size)])
      elif 'sched' in self._categories:
        # 'sched' is a high-volume tag, double the default buffer size
        # to accommodate that
        atrace_args.extend(['-b', '4096'])
      extra_args = self._construct_extra_trace_command()
      atrace_args.extend(extra_args)

      tracer_args = util.construct_adb_shell_command(
          atrace_args, self._options.device_serial)

    return tracer_args
Beispiel #6
0
 def _construct_list_categories_command(self):
   return util.construct_adb_shell_command(
         LIST_CATEGORIES_ARGS, self._options.device_serial)