Ejemplo n.º 1
0
 def kill(self, stagedShutdown = False):
     if self.utilityPath:
         # Take a screenshot to capture the screen state just before
         # the application is killed. There are on-device screenshot
         # options but they rarely work well with Firefox on the
         # Android emulator. dump_screen provides an effective
         # screenshot of the emulator and its host desktop.
         dump_screen(self.utilityPath, get_default_logger())
     if stagedShutdown:
         # Trigger an ANR report with "kill -3" (SIGQUIT)
         self.dm.killProcess(self.procName, 3)
         time.sleep(3)
         # Trigger a breakpad dump with "kill -6" (SIGABRT)
         self.dm.killProcess(self.procName, 6)
         # Wait for process to end
         retries = 0
         while retries < 3:
             pid = self.dm.processExist(self.procName)
             if pid and pid > 0:
                 print "%s still alive after SIGABRT: waiting..." % self.procName
                 time.sleep(5)
             else:
                 return
             retries += 1
         self.dm.killProcess(self.procName, 9)
         pid = self.dm.processExist(self.procName)
         if pid and pid > 0:
             self.dm.killProcess(self.procName)
     else:
         self.dm.killProcess(self.procName)
Ejemplo n.º 2
0
 def kill(self, stagedShutdown=False):
     # Take a screenshot to capture the screen state just before
     # the application is killed.
     if not self.device._device_serial.startswith('emulator-'):
         dump_device_screen(self.device, get_default_logger())
     elif self.utilityPath:
         # Do not use the on-device screenshot options since
         # they rarely work well with Firefox on the Android
         # emulator. dump_screen provides an effective
         # screenshot of the emulator and its host desktop.
         dump_screen(self.utilityPath, get_default_logger())
     if stagedShutdown:
         # Trigger an ANR report with "kill -3" (SIGQUIT)
         try:
             self.device.pkill(self.procName, sig=3, attempts=1)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
         time.sleep(3)
         # Trigger a breakpad dump with "kill -6" (SIGABRT)
         try:
             self.device.pkill(self.procName, sig=6, attempts=1)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
         # Wait for process to end
         retries = 0
         while retries < 3:
             if self.device.process_exist(self.procName):
                 print("%s still alive after SIGABRT: waiting..." % self.procName)
                 time.sleep(5)
             else:
                 return
             retries += 1
         try:
             self.device.pkill(self.procName, sig=9, attempts=1)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             print("%s still alive after SIGKILL!" % self.procName)
         if self.device.process_exist(self.procName):
             self.device.stop_application(self.procName)
     else:
         self.device.stop_application(self.procName)
Ejemplo n.º 3
0
 def dumpScreen(self, utilityPath):
     if self.haveDumpedScreen:
         self.log.info("Not taking screenshot here: see the one that was previously logged")
         return
     self.haveDumpedScreen = True
     dump_screen(utilityPath, self.log)
Ejemplo n.º 4
0
 def kill(self, stagedShutdown=False):
     # Take a screenshot to capture the screen state just before
     # the application is killed.
     # Do not use the on-device screenshot options since
     # they rarely work well with Firefox on the Android
     # emulator. dump_screen provides an effective
     # screenshot of the emulator and its host desktop.
     if not self.device._device_serial.startswith('emulator-'):
         dump_device_screen(self.device, get_default_logger())
     elif self.utilityPath:
         dump_screen(self.utilityPath, get_default_logger())
     if stagedShutdown:
         # Trigger an ANR report with "kill -3" (SIGQUIT)
         try:
             self.device.pkill(self.procName, sig=3, attempts=1, root=True)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
         time.sleep(3)
         # Trigger a breakpad dump with "kill -6" (SIGABRT)
         try:
             self.device.pkill(self.procName, sig=6, attempts=1, root=True)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
         # Wait for process to end
         retries = 0
         while retries < 3:
             if self.device.process_exist(self.procName):
                 print("%s still alive after SIGABRT: waiting..." % self.procName)
                 time.sleep(5)
             else:
                 break
             retries += 1
         if self.device.process_exist(self.procName):
             try:
                 self.device.pkill(self.procName, sig=9, attempts=1, root=True)
             except ADBTimeoutError:
                 raise
             except:  # NOQA: E722
                 print("%s still alive after SIGKILL!" % self.procName)
         if self.device.process_exist(self.procName):
             self.device.stop_application(self.procName)
     else:
         self.device.stop_application(self.procName)
     # Test harnesses use the MOZ_CRASHREPORTER environment variables to suppress
     # the interactive crash reporter, but that may not always be effective;
     # check for and cleanup errant crashreporters.
     crashreporter = "%s.CrashReporter" % self.procName
     if self.device.process_exist(crashreporter):
         print("Warning: %s unexpectedly found running. Killing..." % crashreporter)
         try:
             self.device.pkill(crashreporter, root=True)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
     if self.device.process_exist(crashreporter):
         print("ERROR: %s still running!!" % crashreporter)
Ejemplo n.º 5
0
 def dumpScreen(self, utilityPath):
     if self.haveDumpedScreen:
         self.log.info("Not taking screenshot here: see the one that was previously logged")
         return
     self.haveDumpedScreen = True
     dump_screen(utilityPath, self.log)