Esempio n. 1
0
    def _Run(self, runnable, count, no_patch=False):
        suffix = ' - without patch' if no_patch else ''
        target_dir = "bin_no_patch" if no_patch else "bin"
        title = ">>> %%s (#%d)%s:" % ((count + 1), suffix)
        cache = cache_control.CacheControl(self.device)
        cache.DropRamCaches()
        binary_on_device = os.path.join(AndroidPlatform.DEVICE_DIR, target_dir,
                                        runnable.binary)
        cmd = [binary_on_device] + runnable.GetCommandFlags(self.extra_flags)

        # Relative path to benchmark directory.
        if runnable.path:
            bench_rel = os.path.normpath(os.path.join(*runnable.path))
        else:
            bench_rel = "."

        try:
            output = self.device.RunShellCommand(
                cmd,
                cwd=os.path.join(AndroidPlatform.DEVICE_DIR, bench_rel),
                timeout=runnable.timeout,
                retries=0,
            )
            self._PrintStdout(title, output)
        except device_errors.CommandTimeoutError:
            print ">>> Test timed out after %ss." % runnable.timeout
            stdout = ""
        return stdout
Esempio n. 2
0
    def Run(self, runnable, count):
        cache = cache_control.CacheControl(self.device)
        cache.DropRamCaches()
        binary_on_device = os.path.join(AndroidPlatform.DEVICE_DIR, "bin",
                                        runnable.binary)
        cmd = [binary_on_device] + runnable.GetCommandFlags(self.extra_flags)

        # Relative path to benchmark directory.
        if runnable.path:
            bench_rel = os.path.normpath(os.path.join(*runnable.path))
        else:
            bench_rel = "."

        try:
            output = self.device.RunShellCommand(
                cmd,
                cwd=os.path.join(AndroidPlatform.DEVICE_DIR, bench_rel),
                timeout=runnable.timeout,
                retries=0,
            )
            stdout = "\n".join(output)
            print ">>> Stdout (#%d):" % (count + 1)
            print stdout
        except device_errors.CommandTimeoutError:
            print ">>> Test timed out after %ss." % runnable.timeout
            stdout = ""
        return stdout
 def _SetupTracing(self):
     # TODO(lizeb): Figure out how to clean up the command-line file when
     # _TearDownTracing() is not executed in StopTracing().
     changer = flag_changer.FlagChanger(self._device,
                                        self._package_info.cmdline_file)
     changer.AddFlags(['--trace-startup'])
     self._device.ForceStop(self._package_info.package)
     if self._cold:
         self._device.EnableRoot()
         cache_control.CacheControl(self._device).DropRamCaches()
     self._device.StartActivity(intent.Intent(
         package=self._package_info.package,
         activity=self._package_info.activity,
         data=self._url,
         extras={'create_new_tab': True}),
                                blocking=True)
 def FlushEntireSystemCache(self):
     cache = cache_control.CacheControl(self._device)
     cache.DropRamCaches()